Commit Graph

94 Commits

Author SHA1 Message Date
Greg Wilkins b63c5ef611
HttpMessage interface for BadMessageException
Convert class BadMessageException to a HttpMessage.RuntimeException to allows different types of HttpExceptions exceptions.
This follows the pattern of the QuietException interface.
2023-03-10 09:59:05 +01:00
Greg Wilkins 0ca6295cbc
Rename process to handle (#9385)
Renamed Request.Processor to Request.Handler
Renamed Handler.process to Handler.handle
Renamed Rule.Processor to Rule.Handler.
Renamed accordingly methods and variable.
Updated comments accordingly.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Co-authored-by: Simone Bordet <simone.bordet@gmail.com>
2023-02-16 18:21:12 +01:00
gregw a15af55a56 Merge remote-tracking branch 'origin/jetty-11.0.x' into jetty-12.0.x
Signed-off-by: gregw <gregw@webtide.com>
2023-02-15 15:31:33 +11:00
Lachlan Roberts 6950d73fce Merge remote-tracking branch 'origin/jetty-12.0.x' into jetty-12.0.x-multipartCleanups 2023-02-08 11:55:37 +11:00
Simone Bordet d02932f690
Fixes #9288 - Jetty 12 - Use oej.http.HttpCookie in jetty-client. (#9289)
* Replaced usages of java.net.HttpCookie with oej.http.HttpCookie.
* Moved server-side only methods from HttpCookie to HttpCookieUtils.
* Introduced and implemented oej.http.HttpCookieStore.
* Removed now obsolete oej.util.HttpCookieStore.
* Introduced HttpScheme.isSecure(String), to avoid code duplication.
* Fixed handling of cookie "localhost" domain in HttpClient.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2023-02-07 17:28:01 +01:00
Greg Wilkins f565122571
Redo Handler renaming (#9318)
* Redo Handler renaming

Wrapper to Singleton
BaseWrapper to Wrapper

* Updates from review
2023-02-07 16:41:15 +11:00
Simone Bordet 5cc07994c0
Issue #9300 - Rename RetainableByteBufferPool to ByteBufferPool
ArrayRetainableByteBufferPool -> ArrayByteBufferPool.
Updated field names.
Updates tests.
Updated *.mod files to not reference RetainableByteBufferPool.
Updated javadocs.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2023-02-06 10:31:14 +01:00
Simone Bordet 44980ebfc3
Merge branch 'issue/9284' of https://github.com/kohlschuetter/jetty.project into kohlschuetter-issue/9284 2023-02-06 10:16:32 +01:00
Greg Wilkins 60a08f5349
Rename Handler Nested & Collection (#9305)
There is now a Handler interface hierarchy:
 + Container is a Handler that has 1 or more contained Handlers.
 + Wrapper is a Container with only 1 handler and a setHandler method.
 + Collection is a Container with n handlers and a addHandler method

class are now:
 + Abstract implements Handler
 + AbstractContainer extends Abstract implements Container
 + BaseWrapper extends AbstractContainer implements Wrapper
 + Sequence extends AbstractContainer implements Collection

 Lots of other associated cleanups
2023-02-06 12:15:35 +11:00
Lachlan Roberts c7e7fd837c Merge remote-tracking branch 'origin/jetty-12.0.x' into jetty-12.0.x-multipartCleanups 2023-02-06 11:18:19 +11:00
Olivier Lamy a600506155
fix merge
Signed-off-by: Olivier Lamy <olamy@apache.org>
2023-02-05 16:08:11 +10:00
dependabot[bot] 44cd3ee541
Bump maven.surefire.plugin.version from 3.0.0-M5 to 3.0.0-M8 (#9255) 2023-02-05 15:58:03 +10:00
Christian Kohlschütter b8ab66fd1d Rename RetainableByteBufferPool to ByteBufferPool
With issue #9166, ByteBufferPool was removed and replaced by
RetainableByteBufferPool. Since ByteBufferPool was used by
AbstractConnector, this change broke backwards compatibility with
third-party connectors such as junixsocket-jetty.

Since there's no longer any other ByteBufferPool, rename the
RetainableByteBufferPool interface, and thereby not only reinstate
compatibility with existing third-party libraries but also save a few
keystrokes.

https://github.com/eclipse/jetty.project/issues/9284

Signed-off-by: Christian Kohlschütter <christian@kohlschutter.com>
2023-02-04 23:39:29 +01:00
Simone Bordet c18194b20f
Issue #9293 - Jetty 12 - Relax JPMS dependencies (fcgi) (#9306)
Relaxed jetty-fcgi JPMS dependencies.
Packages generator and parser were not internal,
was just matters of exporting them.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2023-02-04 14:38:08 +01:00
Simone Bordet cd5031b15f
Issue #9293 - Jetty 12 - Relax JPMS dependencies.
Relaxed jetty-client JPMS dependencies.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2023-02-02 19:30:40 +01:00
Lachlan Roberts 4ffad09335 Merge remote-tracking branch 'origin/jetty-12.0.x' into jetty-12.0.x-9066-MultiPart-getParameters 2023-02-01 12:42:35 +11:00
Simone Bordet cd732a175c
Review and normalized all Maven module <name> for consistency.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2023-01-27 19:09:30 +01:00
Simone Bordet ded18f523d
Fixes #9166 - Jetty 12: review/remove ByteBufferPool (#9195)
* Fixes #9166 - Jetty 12: review/remove ByteBufferPool

* Replaced usages of ByteBufferPool with RetainableByteBufferPool.
* Removed ByteBufferPool and related classes.
* Renamed oej.http2.frames.DataFrame.getData() -> getByteBuffer() for consistency.
* Removed Accumulator.acquire(), and updated code to use RetainableByteBufferPool.acquire() instead.
* Fixed HttpOutput callbacks to correctly call super.onCompleteSuccess() and super.onCompleteFailure().

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2023-01-27 13:40:49 +01:00
Lachlan Roberts d4682f4b85 Fix testMaxRequest size test in MultiPartServletTest
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2023-01-25 10:39:20 +11:00
Greg Wilkins 8b3bcc3a50
Cleanup non-retainable `Retainable`s (#9159)
`Retainable`s that return false from `canRetain()` now are noops if `retain()` is called, which allows for a simpler calling convention.
`AsyncContent` has also been reworked to allocate less and be clearer in its use of `canRetain()`.
2023-01-13 10:37:16 +01:00
Simone Bordet 46355c6110
Fixes retainability of special Chunks (#9073)
* Fixes #8993 - Retainability of special Chunks

* Restored Jetty 11's AsyncContentProducer and related classes in jetty-ee9-nested module (src and test).
* Introduced Retainable.canRetain().
* Removed Chunk.isTerminal() and replaced it with alternative method calls.
* Clarified AsyncContent.write() in case of Chunk.Error.
* Removed AsyncContent.write(Chunk, Callback) because it was making the API confusing.
  For example, AsyncContent.close() clashing with write(EOF, NOOP), or
  AsyncContent.fail(x) clashing with write(Chunk.Error, NOOP), etc.
* Improved usage of Chunk.from(..., Retainable).
* Improved usage of Chunk.slice().
* Using from() in MultiPart, rather than duplicating code.
* Fixed MultiPart.Parser.Listener.onPartContent() javadocs.
* Renamed non-retaining Chunk.from() to Chunk.asChunk().
* Removed Chunk.slice() methods, inlining them where necessary.
* Carefully reviewed all usages of read()-like methods that return a Retainable instance to make sure it is released.
* Updated HTTP/2 and HTTP/3 usages of Stream.Data to follow the correct retain/release semantic.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2023-01-13 01:10:56 +01:00
Simone Bordet a1c5cefd0d
Reorganization of jetty-client classes. (#9127)
* Reorganization of jetty-client classes.

* Moved oej.client.api to oej.client
* Moved oej.client.util to oej.client
* Moved implementation classes to oej.client.internal
* Moved transports to oej.client.transport
* Moved transport implementation classes to oej.client.transport.internal
* Moved TunnelRequest to oej.client.internal.

* Moved FastCGI transport classes to o.e.j.fcgi.transport
* Moved FastCGI transport implementation classes to o.e.j.fcgi.transport.internal

* Updated WebSocket core client to use only exported, non-internal, oej.client classes.

* Expanded oej.client.Destination APIs:
  - added: getOrigin(), isSecure(), getProxy(), getConnectionPool(), getHttpClient(), send(..).
  - removed: getScheme(), getHost(), getPort() because they don't uniquely identify a Destination anymore (Origin does)
* Moved destination sweeper functionality from HttpDestination to HttpClient.
  HttpDestination does not implement close() anymore, now relies on LifeCycle.stop()
* Moved HttpReceiver.storeCookie() logic to HttpClient.putCookie() to avoid exposing CookieManager.
* Moved HttpClient.getAcceptEncodingField() to ContentDecoder.Factories

* Avoid public/protected Logger instances.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2023-01-11 10:05:43 +01:00
Ludovic Orban fcbdab8b3e
Rework client content listeners (#8981)
* Removed DemandedContentListener
* Updated AsyncContentListener signature
* Updated documentation

Signed-off-by: Ludovic Orban <lorban@bitronix.be>
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Co-authored-by: Simone Bordet <simone.bordet@gmail.com>
2023-01-04 11:01:18 +01:00
Greg Wilkins c18e790858
Jetty 12 handler as boolean processor (#9035)
Alternative Handler architecture.

All Handlers are Processors, which now return a boolean to indicate the request has been accepted.
The request/response/callback are no longer modal, so there is no race with the boolean return.

Optimized PathMappings.
Avoid iterations if only ServletPathSpec instances
Avoid tests for empty mappings.
Better reset implementation
Improve suffix matching
Improve exact matching

Renamed HttpStream.getNanoTimeStamp() to getNanoTime().

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Co-authored-by: Simone Bordet <simone.bordet@gmail.com>
2022-12-19 16:02:26 +01:00
Simone Bordet ee685b23fa
Merged branch 'jetty-11.0.x' into 'jetty-12.0.x'.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2022-12-07 16:23:11 +01:00
Ludovic Orban 017b6c1391 fcgi and ContentTransformer bug fixes
Signed-off-by: Ludovic Orban <lorban@bitronix.be>
2022-12-06 20:04:30 +01:00
Ludovic Orban 12e48a7241 replace FSM with SerializedInvoker
Signed-off-by: Ludovic Orban <lorban@bitronix.be>
2022-11-29 09:31:49 +01:00
Simone Bordet e7f6f6729a
Restored server push functionality. (#8760)
* Restored server push functionality.

* Moved Request.isPushSupported() to ConnectionMetaData.
* Removed HttpStream.isPushSupported().
* Implemented ee10 PushBuilder.
* Moved PushCacheFilterTest from core to ee10.
* Duplicated PushCacheFilterTest to ee9.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Co-authored-by: Greg Wilkins <gregw@webtide.com>
2022-11-21 12:18:19 +01:00
Greg Wilkins 1885df7e03 WIP replacing getPathInContext with static method 2022-10-23 22:36:15 +11:00
Ludovic Orban 38289e46d4
Make Client's Request and Response `abort()` fully async (#8725)
Changed Request and Response abort() to be fully async by returning a CompletableFuture<Boolean>

Signed-off-by: Ludovic Orban <lorban@bitronix.be>
2022-10-21 15:32:46 +02:00
Simone Bordet 0d0790834d
Moved FastCGIProxyServlet in ee9 to FastCGIProxyHandler in core. (#8718)
Moved FastCGIProxyServlet in ee9 to FastCGIProxyHandler in core.
Moved TryFilesFilter in ee9 to TryPathsHandler in core.
Update Jetty modules to properly setup the class-path in case of proxy usage.

Fixes Surefire configuration to run the tests.
The problem is that fcgi-proxy depends on fcgi-client, so both will be put on the module-path.
However, fcgi-server is used for the tests, it is in the class-path, but depends on fcgi-client that is on the module-path.
Therefore, when a fcgi-server class tries to access a fcgi-client class, JPMS throws because the fcgi-client module does not export to the unnamed module.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2022-10-18 00:00:34 +02:00
Simone Bordet c785f08b17
[Jetty 12] Made WebSocket over HTTP/2 work. (#8685)
* Made WebSocket over HTTP/2 work.

Re-enabled tests, and restored HTTP2StreamEndPoint,
as well as implemented getTunnelSupport() for HTTP/2.

Removed from HttpStream methods for upgrade that are
not necessary anymore.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2022-10-07 12:50:42 +02:00
Simone Bordet d3e16fcff9 Updates from reviews.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2022-09-21 20:03:49 +02:00
Simone Bordet 854d5cdf6a Renamed ee9 client transport tests package.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2022-09-21 20:03:49 +02:00
Simone Bordet 8953873e67
Merged branch 'jetty-11.0.x' into 'jetty-12.0.x'.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2022-09-06 12:31:54 +02:00
Simone Bordet 21fce4ffb9
Pool and ConnectionPool code cleanups
Code cleanup, removing deprecations, for class Pool,
ConnectionPool and its implementations.

Removed DuplexHttpDestination and MultiplexHttpDestination.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2022-08-13 10:01:36 +02:00
Simone Bordet 7d264e6024
Jetty 12 module renaming - jetty-http2.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2022-08-12 09:33:31 +02:00
Simone Bordet 11c3642892
Jetty 12 module renaming - jetty-fcgi.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2022-08-12 09:33:31 +02:00
Simone Bordet 69a7b06f06
Jetty 12.0.x retainable chunk (#8325)
Made Chunk implement Retainable, and protocol implementations
to link the RetainableByteBuffer all the way to the Chunk.

Extended Retainable to have both a retain() and a release() methods.

Removed HTTP/2's ISession and IStream, now just using HTTP2Session and HTTP2Stream.
Removed *.Adapter classes in favor of interfaces with default methods.

Javadoc additions and clarifications.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2022-07-25 13:22:14 +02:00
Greg Wilkins fe83ea87dc Merge remote-tracking branch 'origin/jetty-11.0.x' into jetty-12.0.x 2022-07-04 11:32:33 +10:00
Simone Bordet 7a6ccce49a
Rewrite of the content handling, both on client and on server. (#7985)
Introduced a new io.Content class, with Content.Source, Content.Sink and Content.Chunk.

Updated the server-side to use io.Content instead of the previous server-side Content class.
Updated the client-side to use io.Content with a little specialization necessary for clients only.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Co-authored-by: Ludovic Orban <lorban@bitronix.be>
2022-05-30 13:34:51 +02:00
Jan Bartel 39c5395fb1 Add --reads org.eclipse.jetty.logging to surefire config 2022-05-24 20:34:13 +10:00
Greg Wilkins 04acdb72f0 Jetty-12 Restructure
Copied over non ee10 components from the hackathon branch

Co-authored-by: Greg Wilkins <gregw@webtide.com>
Co-authored-by: Jan Bartel <janb@webtide.com>
Co-authored-by: Joakim Erdfelt <joakim@webtide.com>
Co-authored-by: Lachlan Roberts <lachlan@webtide.com>
Co-authored-by: Ludovic Orban <lorban@webtide.com>
Co-authored-by: Olivier Lamy <olamy@webtide.com>
Co-authored-by: Simone Bordet <sbordet@webtide.com>
2022-05-03 15:50:54 +02:00
Greg Wilkins 825fa75993 Jetty-12 Restructure
Git moved files into their known new locations

Co-authored-by: Greg Wilkins <gregw@webtide.com>
Co-authored-by: Jan Bartel <janb@webtide.com>
Co-authored-by: Joakim Erdfelt <joakim@webtide.com>
Co-authored-by: Lachlan Roberts <lachlan@webtide.com>
Co-authored-by: Ludovic Orban <lorban@webtide.com>
Co-authored-by: Olivier Lamy <olamy@webtide.com>
Co-authored-by: Simone Bordet <sbordet@webtide.com>
2022-05-03 15:46:22 +02:00