Commit Graph

27221 Commits

Author SHA1 Message Date
Jan Bartel ad344c7d23
Uncomment websocket deps for ee9 jetty maven plugin (#9189)
* Uncomment websocket deps for ee9 jetty maven plugin

* Update jetty-ee8-maven-plugin pom
2023-01-24 18:22:35 +11:00
Simone Bordet 8076aa10e7
Fixes implicit narrowing conversion reported in #9166.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2023-01-23 19:51:53 +01:00
Joakim Erdfelt 26a4ee5454
Jetty 12 - Introduce `GracefulShutdownHandler` and Test (#9174)
* Introduce GracefulShutdownHandler and test

+ started with removing `@Disabled` from `GracefulStopTest.java`
+ GracefulShutdownHandler based on Callback manipulation
2023-01-23 09:17:27 -06:00
Joakim Erdfelt 7920102702
Issue #9173 - Make wrapping of `ServletApiResponse` easier (#9175)
* Issue #9173 - Make wrapping of ServletApiResponse easier

* Fixing checkstyle and missing licenses
* Improved HttpCookie with javadoc and attribute handling
2023-01-23 08:23:30 -06:00
Olivier Lamy 039503c8e9
no need to use an agent here before the real build
Signed-off-by: Olivier Lamy <olamy@apache.org>
2023-01-23 11:44:31 +10:00
Joakim Erdfelt 4993291af0
Wrong value of `RequestDispatcher.FORWARD_CONTEXT_PATH` attribute on root context (#9123)
* Wrong value of RequestDispatcher.FORWARD_CONTEXT_PATH on root context

* Fixes #9119 - uses proper context path that
  satisfies the root context rules of the servlet
  spec

Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
2023-01-20 08:16:43 -06:00
Greg Wilkins 99fdd219b7
Jetty 12.0.x 9131 remove path watcher (#9158)
* Reverted to Scanner for PropertyUserStore
* Remove PathWatcher from unassembled fork mode.

Signed-off-by: Greg Wilkins <gregw@webtide.com>
Co-authored-by: Jan Bartel <janb@webtide.com>
2023-01-20 08:03:27 +11:00
Greg Poulos 06efbcaa7c
Jetty 12.0.x document modules (#9151)
* Add documentation in "Standard Modules" section for the jmx module
* Add documentation in "Standard Modules" section for the ee8,9,10-webapp modules
* Use shorter markup tags to transclude documentation from .mod files
* Extract EE version strings into variables
* Replace literal usages of EE version numbers with custom attribute
* Use convention 'eeN' instead of 'eex' in filenames
* Update metadata tag for deploy module documentation
* Update deploy module documentation to discuss EE platform-specific deploy modules
* Add documentation for the resources module
* Add resources module into section table of contents
* Use jetty-home instead of JETTY_HOME as documentation attribute

Co-authored-by: Simone Bordet <simone.bordet@gmail.com>
2023-01-19 19:02:42 +01:00
Joakim Erdfelt fc762aea7d
Remove `@Disabled` from more `jetty-core/jetty-server` tests (#9162)
* Remove @Disabled from ConnectorTimeoutTests
* Remove @Disabled from SlowClientsTest
* Remove @Disabled from SslConnectionFactoryTest
* Remove @Disabled from DetectorConnectionTest
* Disabling quiche from checkstyle
* Removing ConnectorTimeoutTest BlockingTimeout tests
  + The concept of HttpConfiguration.blockingTimeout
     has been removed, these tests are no longer relevant
2023-01-19 10:31:51 -06:00
Joakim Erdfelt a37b8523e5
Jetty 12 - Javadoc cleanup & new inspection profile (#9165)
* Adding intellij-javadoc-inspection.xml for Jetty specific Javadoc inspection profile.
* Javadoc cleanup
2023-01-19 10:31:27 -06:00
Simone Bordet 0a002d7785
Merged branch 'jetty-11.0.x' into 'jetty-12.0.x'.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2023-01-19 15:23:13 +01:00
Simone Bordet 8a2e8133a9
Merged branch 'jetty-10.0.x' into 'jetty-11.0.x'.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2023-01-19 15:11:53 +01:00
Simone Bordet 7fd62668d7
Fixes #9183 - ConnectHandler may close the connection instead of send… (#9184)
* Fixes #9183 - ConnectHandler may close the connection instead of sending 200 OK.

Delaying the call to UpstreamConnection.fillInterested() until the 200 OK response has been sent.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2023-01-19 15:07:22 +01:00
Ludovic Orban f3c229437a
Add latency recording utility handler (#9172)
* #8069 add latency recording handler

Signed-off-by: Ludovic Orban <lorban@bitronix.be>
2023-01-19 10:27:05 +01:00
Jan Bartel 7005300421 Merge remote-tracking branch 'origin/jetty-11.0.x' into jetty-12.0.x 2023-01-18 10:24:39 +11:00
Jan Bartel ec9d6e0003 Merge remote-tracking branch 'origin/jetty-10.0.x' into jetty-11.0.x 2023-01-18 09:52:00 +11:00
Piotrek Żygieło 5659e6df5b
Do not execute any phase for maven plugin :start (#9128) 2023-01-18 09:50:20 +11:00
Joakim Erdfelt a06d1a29bb
Jetty 12 - Fix for HttpParser quick HTTP Version lookahead (#9171)
+ Removed the array optimized look ahead
+ version lookahead now done with getInt
+ improved test harness to check lf and crlf endings
+ added HTTP as int optimization
+ fixed bug in near miss of field cache

Signed-off-by: Greg Wilkins <gregw@webtide.com>
Co-authored-by: Greg Wilkins <gregw@webtide.com>
2023-01-18 09:37:55 +11:00
Joakim Erdfelt 6d1e244af6
Merge pull request #9136 from kohlschuetter/jetty-12-NativeImageResourcePath2
* util: Add support for GraalVM Native-Image resource:-URIs and Paths

GraalVM Native-Image makes its classpath resources accessible through an
opaque resource: URL scheme.

Add support for this scheme in URIUtil and PathResource.

Automatically create the NativeImageResourceFileSystem when necessary.
Also add a workaround where converting such Native-Image Paths back to
URI would yield the wrong URI (potentially a bug in GraalVM).

https://github.com/eclipse/jetty.project/issues/9116
https://github.com/oracle/graal/issues/5720

* URIUtil: Suppress CodeQL false positive error about path injection

Github CodeQL code scanning reports a high-severity error "Uncontrolled
data used in path expression", because a path depends on a user-provided
value.

This is a false positive.

Suppress the error by annotating a corresponding @SuppressWarnings tag.

Signed-off-by: Christian Kohlschütter <christian@kohlschutter.com>

* URIUtil: Removed unused code

KNOWN_SCHEMES isn't used anywhere.

* PathResource: Selectively enable resource: for GraalVM Native Image

In regular HotSpot VMs, the resource: scheme may be registered by other
clients. However, in GraalVM Native Image, this is used for classpath
resources.

This resource scheme needs to be enabled by default for Native Image
environments so we can support code that is unaware of GraalVM
internals, such as:

URL resourceURL = MyClass.class.getResource("some/resource");
Resource resource = ResourceFactory.root().newResource(resourceURL);

Signed-off-by: Christian Kohlschütter <christian@kohlschutter.com>

* PathResourceFactory: Ignore certain RuntimeExceptions upon init

Ignore FileSystemAlreadyExistsException, ProviderNotFoundException, etc.
that may be thrown upon calling FileSystems.newFileSystem.

Signed-off-by: Christian Kohlschütter <christian@kohlschutter.com>

* PathResource: Work-around false positive CodeQL warning

CodeQL prevents amending the call to Paths.get.

Work-around this by using a separate constructor. The additional benefit
is that URIUtil.correctResourceURI won't need to correct the URI twice.

Signed-off-by: Christian Kohlschütter <christian@kohlschutter.com>

* PathResource: Fix "isAlias" issue with resource: URIs

Fix two more places where Native Image resource: URIs need to be
changed.

Without this change, Resource#isAlias() would return true for such URIs,
and a warning like "BaseResource resource:/some/package/ is aliased to
resource:file:///resources!/some/package/" would be logged.

* Move GraalVM Native-Image code to NativeImagePathResource/-Factory

Keep the GraalVM Native-Image code contained in custom subclasses.

We still enable the "resource:" URL scheme by default if a GraalVM
Native-Image environment is detected via System property. This allows us
to transparently support calls like
ResourceFactory.root().newResource(MyClass.class.getResorce("webapp"))

Signed-off-by: Christian Kohlschütter <christian@kohlschutter.com>

* Refactor Graal native-image resource: handling

Detect the resource: scheme by checking the scheme of a well-known
resource instead of looking at a system property.

Rename NativeImagePathResource* to GraalIssue5720PathResource* and make
these classes package-private.

Signed-off-by: Christian Kohlschütter <christian@kohlschutter.com>

* Only use GraalIssue5720PathResourceFactory when truly needed

Previously, we were always enabling this resource factory for GraalVM
native-image environments.

We now check if that's actually necessary.

We fall back to MountedPathResourceFactory or PathResourceFactory,
depending on whether the URL contains "!/" or not.

Signed-off-by: Christian Kohlschütter <christian@kohlschutter.com>
2023-01-17 13:08:50 -06:00
Greg Poulos e9f31157ad
Documentation: for consistency, convert "JETTY_HOME" attribute to "jetty-home" (#9152) 2023-01-17 15:44:11 +01:00
Greg Wilkins a4ee42944b suppress test stacks 2023-01-17 16:58:55 +11:00
Greg Wilkins 94991c60c0
Jetty 12 temp directory cleanup (#9153)
+ `Server` now has setter/getter for a temp directory, which can be null
 + `Context` now has a getter for a temp directory, which is never null 
 + Server root Context temp directory is either whatever is set, else a work directory, else java.io.tmpdir
 + WebInfConfiguration will still create a temp directory name, but defers to ContextHandler for creation/persistence of the temp directory
 + temp directory (and BASE) removed from the deployer, as it is now the server temp directory.
2023-01-17 11:44:09 +11:00
Christian Kohlschütter cdea111d3f Only use GraalIssue5720PathResourceFactory when truly needed
Previously, we were always enabling this resource factory for GraalVM
native-image environments.

We now check if that's actually necessary.

We fall back to MountedPathResourceFactory or PathResourceFactory,
depending on whether the URL contains "!/" or not.
2023-01-16 23:27:53 +01:00
Christian Kohlschütter 30ffbcb7e4 Merge remote-tracking branch 'upstream/jetty-12.0.x' into jetty-12-NativeImageResourcePath2 2023-01-16 18:48:04 +01:00
Joakim Erdfelt be3b8f0b9d
Issue #9167 - making assumption in flaky test 2023-01-16 11:33:43 -06:00
Olivier Lamy 58f5e468fc
jetty 12.0.x cleanup duplicate osgi pom metadata (#9093)
* fix naming convention, artifactId == directtory, add comment on maven-eclipse-plugin
* cleanup dependencies from jetty-ee9 osgi
* cleanup dependencies from jetty-ee10 osgi
* remove maven-eclipse-plugin configuration
Signed-off-by: Olivier Lamy <olamy@apache.org>
2023-01-16 11:39:37 +10:00
Joakim Erdfelt 8374860661
Jetty 12 - Add tests in util/resource for alternate FileSystem implementations (#9149)
* Add tests in util/resource for alternate FileSystem implementations
2023-01-13 09:45:42 -06: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
Olivier Lamy de1f74b132
Merge branch 'jetty-11.0.x' into jetty-12.0.x 2023-01-12 10:31:05 +08:00
Olivier Lamy 779f71ca20
Merge branch 'jetty-10.0.x' into jetty-11.0.x 2023-01-12 10:25:48 +08:00
Jan Bartel 012e7c749e
TCK: Dispatch forward and includes attributes do not meet the spec (#9074)
* Named dispatch includes must not have include attributes set.
2023-01-12 12:37:19 +11:00
Olivier Lamy 7c7a7f3c39
re-enable h3 tests (#8773)
* run h3 tests

Signed-off-by: Olivier Lamy <olamy@apache.org>
2023-01-12 09:22:10 +08:00
Joakim Erdfelt 3c63ff2dc6
Merge remote-tracking branch 'origin/jetty-12.0.x' into jetty-12.0.x 2023-01-11 08:17:47 -06:00
Joakim Erdfelt dfd214debe
More fundamental test case 2023-01-11 08:17:37 -06: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
Joakim Erdfelt 03569efb6c
Removing @Disabled from SslUploadTest 2023-01-10 16:27:09 -06:00
Joakim Erdfelt 0a5c143590
Removing @Disabled from jetty-start 2023-01-10 16:16:13 -06:00
Christian Kohlschütter 8d0d3278a6 Refactor Graal native-image resource: handling
Detect the resource: scheme by checking the scheme of a well-known
resource instead of looking at a system property.

Rename NativeImagePathResource* to GraalIssue5720PathResource* and make
these classes package-private.

Signed-off-by: Christian Kohlschütter <christian@kohlschutter.com>
2023-01-10 14:13:13 +01:00
Ludovic Orban 1295e1e50f #9134 added test
Signed-off-by: Ludovic Orban <lorban@bitronix.be>
2023-01-10 13:34:23 +01:00
Christian Kohlschütter 12d4573add ee10: DefaultServlet: Replace checks for isStreaming() by !isWriting()
Checking for isStreaming() will return false even when no data has been
written yet. This erroneously triggers double-encoding of binary data in
a Writer.

If the Writer is not set to ISO-8859-1 or similar, the output will be
corrupted, causing errors like "java.io.IOException: written
25746 > 12014 content-length", and interrupted transmissions.

Replace the isStreaming() check by !isWriting().

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

Signed-off-by: Christian Kohlschütter <christian@kohlschutter.com>
2023-01-10 13:34:23 +01:00
Ludovic Orban 177bafbace #9078 make HttpContent.getByteBuffer() implementations return new ByteBuffer instances and document that contract
Signed-off-by: Ludovic Orban <lorban@bitronix.be>
2023-01-10 10:18:55 +01:00
Simone Bordet 8d6734cf78
Fixes #9141 - Thread-safe Content.Chunk#slice (#9142)
* Fixes #9141 - Thread-safe Content.Chunk#slice

* Changed Content.Chunk.slice(int, int, boolean) to have the same parameters as ByteBuffer.slice(int, int) for consistency.
* Updated Chunk.slice(int, int, boolean) javadocs.
* Update code that was calling Chunk.slice(int, int, boolean).

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2023-01-10 09:49:39 +01:00
Joakim Erdfelt b4d274e3d3
Remove `@Disabled` from `jetty-jmx` (#9143)
* Remove @Disabled from jetty-jmx
2023-01-09 15:20:55 -06:00
Christian Kohlschütter 6d075a4c17 ee10: DefaultServlet should initialize ResourceFactory unconditionally
Currently, unlike ee9 and ee8, ee10's DefaultServlet initializes
_resourceFactory  only when either "baseResource" or "resourceBase" are
set as init parameters.

In embedded jetty, the resource base can also be set using
ContextHandler#setBaseResource(Resource), which means that
DefaultServlet would not initialize correctly and therefore prevent
operations like overriding the jetty-dir.css stylesheet by throwing an
otherwise unexplicable NullPointerException.

Change ee10 DefaultServlet to always initialize ResourceFactory, like
the ee9 and ee8 variants do.

Signed-off-by: Christian Kohlschütter <christian@kohlschutter.com>
2023-01-09 18:31:10 +01:00
Joakim Erdfelt 8db7101862
Fixing TypeUtilTest expectation 2023-01-09 10:07:33 -06:00
Joakim Erdfelt ebd45ebb74
Renaming TypeUtilTest.TestClass to .ExampleClass to avoid junit picking it up 2023-01-09 09:42:40 -06:00
Christian Kohlschütter c74ad3cec6 Move GraalVM Native-Image code to NativeImagePathResource/-Factory
Keep the GraalVM Native-Image code contained in custom subclasses.

We still enable the "resource:" URL scheme by default if a GraalVM
Native-Image environment is detected via System property. This allows us
to transparently support calls like
ResourceFactory.root().newResource(MyClass.class.getResorce("webapp"))

Signed-off-by: Christian Kohlschütter <christian@kohlschutter.com>
2023-01-09 16:32:04 +01:00
Ludovic Orban f14c0a5002
Jetty 12.0.x h2c perf improvement: implement equals/hashcode in Stream (#9077)
implement equals/hashcode in H2Stream

Signed-off-by: Ludovic Orban <lorban@bitronix.be>
2023-01-09 10:37:20 +01:00
Christian Kohlschütter a5011d128d PathResource: Fix "isAlias" issue with resource: URIs
Fix two more places where Native Image resource: URIs need to be
changed.

Without this change, Resource#isAlias() would return true for such URIs,
and a warning like "BaseResource resource:/some/package/ is aliased to
resource:file:///resources!/some/package/" would be logged.
2023-01-09 01:12:40 +01:00