Commit Graph

2841 Commits

Author SHA1 Message Date
Joakim Erdfelt 7da57151ed Issue #4033 - lenient percent decode in URIUtil
+ Allows for preserving decoded Strings like "X%YZ"

Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
2019-08-28 12:08:18 -05:00
Joakim Erdfelt b2ea6a0861 Fixing Test Parameterization
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
2019-08-28 10:43:15 -05:00
Greg Wilkins 83463c2a23
Issue #3964 - Listener behavior cleanup (Jetty 9.4.x) (#3965)
Issue #3964
* Avoid creating listener list for rarely used requestAttributeListener
* AbstractConnector keeps a specific list of HttpChannel.Listeners
to avoid Connection.Listeners and MBean listeners being added to
the HttpChannel listener list.
* Simplified listener handling by avoiding null connector, previously
only needed for testing.
* Fixed test that assumed HttpChannel listeners were not cleared by a recycle
* Separated out durable vs cyclic HttpChannel.Listeners, so as to
simplify handling.
* Deprecated cyclic HttpChannel.Listeners, as I'm not sure the channel is
the right place for them.
* Added improved method to combine multiple HttpChannel Listeners
into a single Listener.
* Fixed MockConnector
* Added benchmark
* Improved benchmark
* Updates from review
* Removed benchmark and alternate implementations.
* Updated javadoc
* Updates from review

Signed-off-by: Greg Wilkins <gregw@webtide.com>
2019-08-27 17:38:20 +10:00
Greg Wilkins d216792d23 Made test not fail in symlinked directory
Signed-off-by: Greg Wilkins <gregw@webtide.com>
2019-08-27 13:01:34 +10:00
Greg Wilkins bde86467f4
Issue #3806 - Make Async sendError fully Async (#3912)
* Issue #3806 async sendError

Avoid using isHandled as a test withing sendError as this can be
called asynchronously and is in a race with the normal dispatch of the
request, which could also be setting handled status.

The ErrorHandler was dispatching directly to a context from within
sendError.  This meant that an async thread can call sendError and be
dispatched to within the servlet container at the same time that the
original thread was still dispatched to the container.

This commit fixes that problem by using an async dispatch for error
pages within the ErrorHandler.  However, this introduces a new problem
that a well behaved async app will call complete after calling
sendError.  Thus we have ignore complete ISEs for the remainder of
the current async cycle.

Fixed the closing of the output after calling sendError. Do not
close if the request was async (and thus might be dispatched to an
async error) or if it is now async because the error page itself is
async.

* updates from review
* better tests
* revert ignore complete
* added some TODOs
* more TODOs
* fixed rename
* cleanup ISE and more TODOs
* refactored to call sendError for uncaught exceptions rather than onError
* more of the refactor
* extra tests for sendError from completing state

Reworked HttpChannelState and sendError so that sendError is now
just a change of state. All the work is done in the ErrorDispatch
action, including calling the ErrorHandler.  Async not yet working.

Additional tests

Converted ERRORED state to a separate boolean so it can be used for
both Sync and Async dispatches.

Removed ASYNC_IO state as it was just the same as DISPATCHED

The async onError listener handling is now most likely broken.


WIP making sendError simpler and more tests pass
WIP handling async and thrown exceptions
WIP passing tests

Improved thread handling

removed bad test

Implemented error dispatch on complete properly
more fixed tests

sendError state looks committed

- Added resetContent method to leave more non-content headers during sendError
- Fixed security tests
- simplified the non dispatch error page writing.  Moved towards being able to write async

* fixed gzipHandlerTest

* Updated handling of timeout errors.  According to servlet spec,
exceptions thrown from onTimeout should not be passed to onError, but
just logged and ignored:

   If an exception is thrown while invoking methods in an AsyncListener,
   it is logged and will not affect the invocation of any other AsyncListeners.

* This changes several tests.

* Dispatcher/ContextHandler changes for new ERROR dispatch handling. Feels a bit fragile!

* Fixed tests in jetty-servlets
* Fixed tests in jetty-proxy

* more test fixes

* Fixed head handling
reverted unnecessary changes
Improved reason handling

WIP on fully async error handling.
Simplified HttpChannelState state machines to allow for async actions
during completing

more WIP on fully async error handling.

sendError and completion are not both non-blocking, without using
a startAsync operation. However we are lacking unit tests that actually
exercise those code paths.

* Simplified name of states
Added test for async completion
* Cleanups and javadoc
* Cleanups and javadoc
* remove snake case
* feedback from review
* Write error page into fixed pooled buffer

Use the response to get/release a pooled buffer into which the error
page can be written.  Make it a fixed sized buffer and if it overflows
then no error page is generated (first overflow turns off showstacks
to save space).

The ErrorHandler badly needs to be refactored, but we cannot change
API in jetty-9

* More test fixes for different error page format
* minor cleanups
* Cleanup from Review
* Fixed javadoc
* cleanups and simplifications
* Cleanup from Review
* renaming and some TODOs
* Cleanup from Review
* Checkstyle fixes
* Cleanup from Review
* Code cleanups and simplifications
* fixed debug
* Cleanup from Review
* Ensure response sent before server shutdown
* removed unnecessary optimisation
* fixed duplicate from merge
* Updates from review

Signed-off-by: Greg Wilkins <gregw@webtide.com>
2019-08-26 17:55:58 +10:00
Joakim Erdfelt 1867d24ef7
Merge pull request #4001 from eclipse/jetty-9.4.x-4000-swedish-unicode-file-serving
Issue #4000 - new SameFileAliasChecker to help with NFC/NFD UTF-8 differences
2019-08-23 07:27:32 -05:00
Joakim Erdfelt d0ec6e7d07
Merge pull request #3995 from eclipse/jetty-9.4.x-3983-jarfileresource-list
Fixes #3983 - JarFileResource directory listing is invalid
2019-08-22 15:09:16 -05:00
Olivier Lamy fe3d3f7158
fix checkstyle in test sources (#4013)
Signed-off-by: olivier lamy <oliver.lamy@gmail.com>
2019-08-22 19:56:41 +10:00
Joakim Erdfelt 88e37b177c Issue #4000 - Name change to isSameName
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
2019-08-21 17:11:44 -05:00
Joakim Erdfelt 4ab0be9b1b Issue #3983 - Applying PR review to JarFileResource
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
2019-08-21 12:43:25 -05:00
Joakim Erdfelt 30bd3914cf Issue #4000 - SameFileAliasChecker to help with NFD/NFC
+ Adding SameFileAliasChecker to help with environments
  where the Alias and the Path point to the same file,
  by relying on the FileSystem and Path implementation
  to make the determination if the two Path references
  truly point to the same file.
+ Minor cleanup of FileSystemResourceTest
+ Additional DefaultServletTest for this UTF-8 differences

Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
2019-08-21 12:21:04 -05:00
Joakim Erdfelt ef3f696a11 Issue #4000 - PathResource alias detection work around alt UTF-8 style
+ OSX File is `swedish-å.txt`
+ OSX has NFD form UTF-8 characters. `swedish-a%CC%8A.txt`
+ HTTP uses normal form UTF-8. `swedish-%C3%A5.txt`
+ A HTTP GET request should work against the resource
  being requested, regardless of UTF-8 style used.

Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
2019-08-19 13:52:22 -05:00
Joakim Erdfelt 407b564320 Issue #4000 - adding unit test for raw Resource access for unicode file.
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
2019-08-19 12:52:43 -05:00
Joakim Erdfelt 472ede48cd Issue #3983 - JarFileResource directory listing is invalid
+ Correcting encoded path searching
+ Adding more unit tests to ensure no regression

Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
2019-08-16 15:48:42 -05:00
Joakim Erdfelt f65e59cadf Issue #3983 - Modernizing JarResourceTest
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
2019-08-16 15:13:53 -05:00
Joakim Erdfelt f1efc99918 Updating to version 9.4.21-SNAPSHOT 2019-08-13 17:34:20 -05:00
Joakim Erdfelt 84700530e6 Updating to version 9.4.20.v20190813 2019-08-13 16:13:21 -05:00
Greg Wilkins dc939d753a
Issue #3804 - Update Decorator integration for various CDI implementations (#3838)
* Jetty Issue #3804 WELD-2587

Support CDI integration:
 + cdi2 module exposes jetty APIs
 + cdi module uses DecorationListener

Signed-off-by: Greg Wilkins <gregw@webtide.com>

* Jetty Issue #3804 WELD-2587

Remove DecoratingListener tests from test-jetty-webapp

Signed-off-by: Greg Wilkins <gregw@webtide.com>

* improve CDI test

Signed-off-by: Greg Wilkins <gregw@webtide.com>

* Jetty Issue #3804 WELD-2587

Reverted test to use released CDI and cdi2 module for now.
To test new mechanism, you need to build the weld snapshot locally,
rebuild and switch to cdi module

Signed-off-by: Greg Wilkins <gregw@webtide.com>

* remove cdi2 webapp references

Signed-off-by: Greg Wilkins <gregw@webtide.com>

* document attribute

Signed-off-by: Greg Wilkins <gregw@webtide.com>

* improved documentation

Signed-off-by: Greg Wilkins <gregw@webtide.com>

* logging

Signed-off-by: Greg Wilkins <gregw@webtide.com>

* improved javadoc

Signed-off-by: Greg Wilkins <gregw@webtide.com>

* Fixed version

Signed-off-by: Greg Wilkins <gregw@webtide.com>

* Reverted to also provide the DecoratingListener in the decorate module.
Renamed cdi-demo to weld-cdi-demo

Signed-off-by: Greg Wilkins <gregw@webtide.com>

* revert from Weld SNAPSHOT

Signed-off-by: Greg Wilkins <gregw@webtide.com>

* test all 3 weld integrations

Signed-off-by: Greg Wilkins <gregw@webtide.com>

* updated destory implementation to release creationalcontext

Signed-off-by: Greg Wilkins <gregw@webtide.com>

* reverted to released Weld version

Signed-off-by: Greg Wilkins <gregw@webtide.com>

* Issue #3804 CDI integration

dispose and release context in destroy

Signed-off-by: Greg Wilkins <gregw@webtide.com>

* Improved CDI module documentation

Signed-off-by: Greg Wilkins <gregw@webtide.com>

* WIP on OWB

Signed-off-by: Greg Wilkins <gregw@webtide.com>

* Updates from review
Parameterised CDITests

Signed-off-by: Greg Wilkins <gregw@webtide.com>

* share webapp resources for cdi webapp test

Signed-off-by: olivier lamy <oliver.lamy@gmail.com>

* Initialize OWB with a SCI so that listeners can be decorated

Signed-off-by: Greg Wilkins <gregw@webtide.com>

* Added OwbDecorator so that cdi2 module can be tested with OWB

Signed-off-by: Greg Wilkins <gregw@webtide.com>

* Lookup attribute name

Signed-off-by: Greg Wilkins <gregw@webtide.com>

* Cleanups

Signed-off-by: Greg Wilkins <gregw@webtide.com>

* Cleanup from Review

Don't do lazy bindings

Signed-off-by: Greg Wilkins <gregw@webtide.com>

* Cleanup from Review

Treat partial CDI same as no CDI

Signed-off-by: Greg Wilkins <gregw@webtide.com>

* fix maven it test no more need of weld-servlet

Signed-off-by: olivier lamy <oliver.lamy@gmail.com>

* cleanup it parent pom removing non needed weld servlet

Signed-off-by: olivier lamy <oliver.lamy@gmail.com>

* upgraded to Weld 3.1.2.Final

Signed-off-by: Greg Wilkins <gregw@webtide.com>

* Cleanup from Review

Signed-off-by: Greg Wilkins <gregw@webtide.com>

* Cleanup from Review

Signed-off-by: Greg Wilkins <gregw@webtide.com>
2019-08-08 04:04:07 +02:00
Simone Bordet 2e2cde69e9
Merge pull request #3899 from eclipse/jetty-9.4.x-3856-maxForm_contentLength_behavior
Fixes #3856 - Different behaviour with maxFormContentSize=0 if Content-Length header is present/missing.
2019-08-07 19:46:49 +03:00
Joakim Erdfelt cb87d7049e
Merge pull request #3923 from eclipse/jetty-9.4.x-3906-seekablebytechannel-fallback
Issue #3906 - Handling SeekableByteChannel.position(long) Exception
2019-08-07 07:43:16 -05:00
Simone Bordet fa0e7850be
Merge pull request #3938 from eclipse/jetty-9.4.x-3929-http2_deadlock_stopping_server
Fixes #3929 - Deadlock between new HTTP2Connection() and Server.stop().
2019-08-07 12:34:15 +03:00
Simone Bordet b9b79a6ad7 Fixes #3929 - Deadlock between new HTTP2Connection() and Server.stop().
Code cleanup.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2019-08-07 10:51:27 +02:00
Simone Bordet 4b7ba20aae Fixes #3929 - Deadlock between new HTTP2Connection() and Server.stop().
Updated code after review.
Now a managed failed bean is restarted if its container is restarted.
Added more test cases.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2019-08-07 10:44:04 +02:00
Simone Bordet 1fd24b3fca Fixes #3940 - Double initialization of Log.
Removed LOG field, it was used improperly (log and rethrow)
and it's now unnecessary.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2019-08-07 10:04:52 +02:00
Simone Bordet 632e9c57a8 Fixes #3940 - Double initialization of Log.
Restructured the class and cleaned up the code.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2019-08-07 10:04:07 +02:00
Simone Bordet 689e6d71a2 Fixes #3940 - Double initialization of Log.
Removed usage of StringUtil.
Moved fields together at top of the class to avoid
class initialization ordering issues.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2019-08-07 09:59:23 +02:00
Simone Bordet f484b83c2e Fixes #3929 - Deadlock between new HTTP2Connection() and Server.stop().
Added test case.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2019-08-06 11:50:29 +02:00
Simone Bordet 6c1b5982a5 Fixes #3929 - Deadlock between new HTTP2Connection() and Server.stop().
Previously beans were started if they were not running, which
included them being in a STOPPING state.
Now beans are only started if they are in STOPPED state.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2019-08-05 21:08:55 +02:00
Simone Bordet 2488c9611f Merged branch 'jetty-9.4.x' into 'jetty-9.4.x-3856-maxForm_contentLength_behavior'. 2019-08-02 19:13:35 +02:00
Simone Bordet 42815a781b Fixes #3856 - Different behaviour with maxFormContentSize=0 if Content-Length header is present/missing.
Updated code to reflect reviews.
Now lookup of system properties and server attributes is done in
ContextHandler.doStart(), so that the getter always return the
actual value (and this is good for JMX too).

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2019-08-02 19:12:49 +02:00
Joakim Erdfelt c2f76a6be5 Issue #3906 - Handling SeekableByteChannel.setPosition() Exception
+ UnsupportedOperationException now triggers a fallback seek mode

Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
2019-07-31 14:36:16 -05:00
Olivier Lamy 6b07bd23c8
Issue #3918 use Jetty version from pom if not found (#3919)
Signed-off-by: olivier lamy <oliver.lamy@gmail.com>
2019-07-31 20:11:20 +10:00
Joakim Erdfelt 95298d89e9
Merge pull request #3910 from eclipse/jetty-9.4.x-3840-pathresource-byterange
Issue #3840 Static resource byte-range support performance
2019-07-30 20:04:06 -05:00
Joakim Erdfelt dc4b7b1791
Merge pull request #3889 from eclipse/jetty-9.4.x-3888-huge-resources
Issue #3888 - Huge file Resources behaviors
2019-07-30 20:03:34 -05:00
Joakim Erdfelt 7a867c0ff0 Issue #3840 - Applying ByteBuffer niggle from PR review
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
2019-07-30 19:59:49 -05:00
Joakim Erdfelt 43f9553a5e Issue #3840 - Adding more robust PathResource.writeTo()
+ Using techniques from SeekableByteChannelRangeWriter
  with variant for -1 count parameter

Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
2019-07-30 17:12:07 -05:00
Joakim Erdfelt fd9ec22876 Issue #3840 - Adding Default FileSystem check to PathResource
+ Construction of PathResource now tests if path belongs
  to the Default FileSystem or not.  This important info
  for later actions against the PathResource that would
  need to know the File object for the Path object.
  Non-Default FileSystem == null
  Default FileSystem == Path.toFile()

Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
2019-07-30 13:58:09 -05:00
Joakim Erdfelt 8601baa3cc Issue #3804 - PathResource should not use SPARSE hint always
+ SPARSE hint only applies to real os file systems or
  default file systems, not for all file systems.

Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
2019-07-26 13:32:03 -05:00
Joakim Erdfelt e5bce5f7cd Issue #3840 - Static resource byte-range support performance
+ Reverting toFile().getInputStream() on PathResource
+ Adding RangeWriter concept for managing open resource
  across multiple range writes
+ RangeWriter implementation delegates to HttpContent behaviors
  Lookup is :
  - Direct Buffer
  - Indirect Buffer
  - ReadableByteChannel (as SeekableByteChannel)
  - InputStream
+ Adding unit tests for all RangeWriter implementation to ensure
  that they behave the same way everywhere.
+ Making ResourceService use new RangeWriter implementation
+ Existing DefaultServletRangeTest still works as-is

Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
2019-07-26 12:36:31 -05:00
Simone Bordet 4e0e962747 Fixes #3822 - trustAll will not work on some servers.
Made TRUST_ALL_CERTS implement X509ExtendedTrustManager,
so that it does not get wrapped in sun.security.ssl.AbstractTrustManagerWrapper,
which performs additional trust checks.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2019-07-26 15:57:53 +02:00
Joakim Erdfelt 24b2ca4c32 Issue #3906 - Introducing Testcase to demonstrate issue
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
2019-07-25 11:43:51 -05:00
Simone Bordet 2629961e74 Fixes #3856 - Different behaviour with maxFormContentSize=0 if Content-Length header is present/missing.
Changes after review.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2019-07-23 22:01:13 +02:00
Simone Bordet d939c9435a Fixes #3856 - Different behaviour with maxFormContentSize=0 if Content-Length header is present/missing.
Fixed zero checks and exception messages.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2019-07-23 15:44:08 +02:00
Joakim Erdfelt 36294ef0da Issue #3888 - Fixing for truncated long to int
+ Allowing CachedHttpContent._contentLengthValue actually hold
  the `long` resource size (for the 4G variant on test)
+ Allowing BufferUtil to not throw Exception if resource length
  is a positive value, but exceeds Integer.MAX_VALUE, opting instead
  to return a null to prevent excessive memory usage. (fixes the 10G
  variant of test)

Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
2019-07-18 12:13:35 -05:00
Olivier Lamy 433709a977
fix modifier order (#3859)
Signed-off-by: olivier lamy <oliver.lamy@gmail.com>
2019-07-09 17:51:05 +10:00
Lachlan Roberts 50c18798ba Merge remote-tracking branch 'eclipse/jetty-9.4.x' into jetty-9.4.x-300-CompressionPool
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2019-07-04 10:19:54 +10:00
Jan Bartel bb7fb48f08
Fix checkstyle warnings for tests. (#3846)
Signed-off-by: Jan Bartel <janb@webtide.com>
2019-07-03 16:42:20 +02:00
Greg Wilkins f84337d5b2
Issue #3840 Slow skip for PathResource (#3845)
Reverted to use FileInputStream

Signed-off-by: Greg Wilkins <gregw@webtide.com>
2019-07-03 11:48:49 +02:00
Greg Wilkins 5c91e44eaf
Issue #3700 better handling of null location (#3837)
Issue #3700 if a location is null then consider if there are inclusions and/or exclusions when matching a class.
Signed-off-by: Greg Wilkins <gregw@webtide.com>
2019-07-03 11:48:09 +02:00
Greg Wilkins 21857f0b81 fixed checkstyle disable style
Signed-off-by: Greg Wilkins <gregw@webtide.com>
2019-07-03 08:33:13 +02:00
Lachlan Roberts 325a084422 Issue #300 - improvements to CompressionPool
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2019-07-03 11:51:05 +10:00
Greg Wilkins 89e756a21e Fix checkstyle warnings
Signed-off-by: Greg Wilkins <gregw@webtide.com>
2019-07-02 13:20:48 +02:00
Greg Wilkins a42ad99871 Misc minor checkstyle fixes
Signed-off-by: Greg Wilkins <gregw@webtide.com>
2019-06-25 11:13:34 +02:00
Lachlan Roberts 2cf0c8aeb8 Merge remote-tracking branch 'jetty-9.4.x' into jetty-9.4.x-300-CompressionPool
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2019-06-25 10:21:43 +10:00
Greg Wilkins 9706d70484
Jetty 9.4.x reformat (#3811)
* Removing Legacy Method Separators
* Restyling branch `jetty-9.4.x`
* Applying changes highlighted by checkstyle
* Applying XML restyling
* Fixing XML codestyle for IntelliJ
* Fixing XML style mistakes
* Revert "Applying XML restyling"
* Updating checkstyle for XML codestyle
* Reformatting pom.xml files
* Fixed empty string from line wraps
* Update intellij style to not do expression relative formatting. Reformatted code based on that.
* Increasing line split on Eclipse IDE Formatter to 512
* Restoring setting on internal default value.
+ IntelliJ will not export settings on things that set to their
  internal default values.
  We want to keep those values as a hedge against future default
  value changes in future releases of IntelliJ.
* Fixing intellij codestyle
* do not allow single line simple methods
* misc checkstyle fixes
* re-exported with correct name and all values

Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
Signed-off-by: Greg Wilkins <gregw@webtide.com>
2019-06-24 17:40:30 +02:00
Joakim Erdfelt 1118750139 Issue #3700 - Fixing bad ClasspathPatternTest assumptions
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
2019-06-21 06:55:59 -05:00
Joakim Erdfelt 075333a627 Merge `jetty-9.4.x` into `jetty-9.4.x-3700-felix-webapp-testing`
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>

# Conflicts:
#	jetty-util/src/main/java/org/eclipse/jetty/util/TypeUtil.java
2019-06-20 15:37:48 -05:00
Joakim Erdfelt 8d59302978 Issue #3700 - Reworking getLocationOfClass()
+ Reverting commit against IncludeExcludeSet
+ TypeUtil.getLocationOfClass is now MethodHandle based
+ new ModuleLocation class provides Module behaviors for Java 9+
  Runtimes, and is used by new MethodHandle based getLocationOfClass
+ Jetty 10 doesn't need reflect complexity of ModuleLocation class
  and can be inlined as real code in TypeUtil
+ TypeUtil.getLocationOfClass is only guaranteed to return the
  URI to the container holding the location of the class, or null.
  - The JAR file - most common
  - The Directory - 2nd most common - a classpath dir entry
  - The jrt:// module reference - if a module reference
+ URLResource support for results of getLocationOfClass is deprecated
  (nothing was using it anyway)

Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
2019-06-20 15:35:10 -05:00
Lachlan Roberts e67532372c Issue #300 - ensure Sessions are stopped before CompressionPools
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2019-06-20 09:09:20 +10:00
Joakim Erdfelt 5eb3e73400 Issue #3700 - Fixing TypeUtil and IncludeExcludeSet to work with null location
+ TypeUtil.getLocationOfClass() respects Class.getClassLoader() of null
  which means a class belonging to Boot ClassLoader, a Primitive, Void,
  or a dynamic in-memory class.  Using system classloader is incorrect
  and invalid in Java 9+
+ Fixing IncludeExcludeSet.test() to always return TRUE or FALSE
  never null.

Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
2019-06-18 11:03:06 -05:00
Greg Wilkins cd38756ef5 fixed formatting from merge
Signed-off-by: Greg Wilkins <gregw@webtide.com>
2019-06-18 09:51:54 +02:00
Greg Wilkins 862e6d008e
Jetty 9.4.x 3755 annotation/jndi example cleanup (#3763)
* Issue #3755 Annotation example cleanup

+ Created JettyDistribution class as common utility to locate a jetty distribution for examples.
+ Fixed ServerWithAnnotations to correctly use the test-spec-webapp
+ Added AttributeContainerMap as a better way to treat attribute values as beans. This avoids them appearing twice in a dump and always associates them with their key.
+ Added NamingDump and use it in EnvConfiguration and jetty-plus.xml so that a server dump will contain dumps of the server local tree and each contexts java:comp/env tree
+ Improved the dump format of NamingContext and WebAppContext
+ Improved the toString format of several associated classes

Signed-off-by: Greg Wilkins <gregw@webtide.com>
2019-06-18 09:50:18 +02:00
Lachlan 275f83c1d0
Issue #3785 - fix failures in QTP testLifeCycleStop (#3788)
make sure the jobs are actually run before calling QTP.stop()

Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2019-06-18 16:01:09 +10:00
Lachlan Roberts 30dc103a12 Issue #300 - manage deflater/inflater pools with ContainerLifeCycle
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2019-06-18 12:31:25 +10:00
Joakim Erdfelt f05d6cf9ad Merge remote-tracking branch 'origin/jetty-9.4.x' into jetty-9.4.x-300-CompressionPool 2019-06-14 08:38:08 -05:00
Lachlan Roberts c30c335df3 Issue #300 - shared Inflater/Deflater pools for WebSocket
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2019-06-14 16:20:00 +10:00
Joakim Erdfelt 40e9e053b9
Merge pull request #3768 from eclipse/jetty-9.4.x-3708-stringutil-replace
Issue #3708 - use StringUtil alternatives for known slow JVM impls.
2019-06-13 14:01:35 -05:00
Joakim Erdfelt 877815e195 Issue #3708 - Adding new methods and converting codebase to use them
+ StringUtil.replace(String, char, char)
+ StringUtil.strip(String, String)
+ URIUtil.encodeSpecific(String, String)
+ URIUtil.decodeSpecific(String, String)
+ TypeUtil.toClassReference(Class)
+ TypeUtil.toClassReference(String)

Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
2019-06-12 09:56:41 -05:00
Lachlan Roberts e8115268d4 Issue #300 - rework of inflater and deflater pools
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2019-06-12 14:21:40 +10:00
Joakim Erdfelt 33fe55c339 Issue #3708 - use StringUtil alternatives for known slow JVM impls.
+ StringUtil.replace()
+ StringUtil.replaceFirst()
+ StringUtil.sanitizeFileSystemPath()

Change existing usages of String.replace() to either
use new StringUtil.replace() or other methods elsewhere
that better suit that specific need.

Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
2019-06-11 11:25:50 -05:00
Joakim Erdfelt ae21126cad Updating to version 9.4.20-SNAPSHOT 2019-06-10 13:40:17 -05:00
Joakim Erdfelt afcf563148 Updating to version 9.4.19.v20190610 2019-06-10 11:17:56 -05:00
Simone Bordet 5b5848eb73
Merge pull request #3716 from eclipse/jetty-9.4.x-log-condense-improvement
Issue #3715 - Improve Log condensePackageString() performance
2019-06-06 22:48:25 +02:00
Olivier Lamy 8f4cdf1c83
upgrade log4j2 version and fix log4j2.xml provided sample (#3721)
* upgrade log4j2 version and fix log4j2.xml provided sample, add disruptor if users wants to use async logging

Signed-off-by: olivier lamy <oliver.lamy@gmail.com>
2019-06-06 20:44:41 +10:00
Jan Bartel 2c634e9125
Remove jetty-util transitive OSGi dependency on servlet-api #3726 (#3741)
Issue #3726 Remove osgi uses clause for deprecated MultiPartInputStreamParser.

Signed-off-by: Jan Bartel <janb@webtide.com>
2019-06-05 23:51:03 +02:00
Joakim Erdfelt 4e00f88946 Issue #3715 - Improve Log condensePackageString() performance
+ Removed regex usage
+ More unit tests
+ Adding jmh test for improvements (see PR #3716 for published results
  of old vs new implementation)

Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
2019-05-31 10:57:38 -05:00
Simone Bordet fe94da9e46 Issue #3713 - Emit warning when invoking deprecated method in Jetty XML.
Added warnings for invocation of deprecated constructors and methods.
Moved methods exclusively used by XmlConfiguration from TypeUtil.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2019-05-30 22:27:27 +02:00
Greg Wilkins 0c61ec3e4d
Fix idle race by allowing idle count to go negative (#3694)
* Fix idle race by allowing idle count to go negative
* Fixed flakey dump test
* don't exit Runner on exceptions
* cleanup after pair programming with sbordet
* longer benchmark runs
* optimized by removing need to check isRunning

Signed-off-by: Greg Wilkins <gregw@webtide.com>

* Code reformatting.
* Fixed stop logic.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2019-05-29 17:24:01 +02:00
Michael Hausegger a3b755858d Added additional Unit Tests to increase code coverage (#3692)
* Added additional Unit Tests to increase code coverage

Signed-off-by: Michael Hausegger <hausegger.michael@googlemail.com>
2019-05-24 16:24:40 +10:00
Olivier Lamy f2c59a3cb7
add convenient StringUtil isEmpty method (#3687)
* add StringUtil.isEmpty

Signed-off-by: olivier lamy <oliver.lamy@gmail.com>
2019-05-23 09:01:36 +10:00
Simone Bordet fd542c2856
Merge pull request #3591 from eclipse/jetty-9.4.x-3550-QueuedThreadPool-cleanup
Jetty 9.4.x 3550 queued thread pool cleanup
2019-05-22 18:18:49 +02:00
Simone Bordet b70d22fee8 Issue #3550 - QueuedThreadPool cleanup.
Improved code formatting.
Removed unnecessary code in doStop().
Now explicitly checking whether idleTimeout > 0 before shrinking.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2019-05-22 18:17:44 +02:00
Joakim Erdfelt 73d7eaaba3 Issue #2909 - Replace B64Code with java.util.Base64
+ Address Mime Encoding behavior difference detected in testcase

Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
2019-05-15 10:08:11 +02:00
Joakim Erdfelt b44ecc932a Issue #2909 - Replace B64Code with java.util.Base64
+ Deprecated B64Code
+ All code that isn't B64CodeTest is now using java.util.Base64
+ B64CodeTest is updated to confirm change to java.util.Base64
  is possible without change in behavior. Just have to make
  sure you use the appropriate Encoder / Decoder for the task
  at hand (default vs mime vs url)

Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
2019-05-15 10:08:11 +02:00
Joakim Erdfelt 09a60cd4f3 Issue #3630 - more HostPort tests
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
2019-05-14 17:08:01 +02:00
Greg Wilkins 05072b34dc Issue #3630 Forwarded-Port
Added support for the X-Forwarded-Port header.
Reimplemented header scanning using more efficient Trie and MethodHandles

Signed-off-by: Greg Wilkins <gregw@webtide.com>
2019-05-14 17:08:01 +02:00
Greg Wilkins 715939217f Fixed reserved thread default
Signed-off-by: Greg Wilkins <gregw@webtide.com>
2019-05-09 16:27:00 +02:00
Greg Wilkins 4dd76fc092 Issue #3550 Cleanup QTP after review
Signed-off-by: Greg Wilkins <gregw@webtide.com>
2019-05-08 14:28:20 +02:00
Greg Wilkins 16b73e55bc Merge branch 'jetty-9.4.x' into jetty-9.4.x-3550-QueuedThreadPool-cleanup 2019-05-08 14:23:30 +02:00
Simone Bordet e45c176649 Fixes #3628 - NPE in QueuedThreadPool.getReservedThreads().
Added guard to avoid NPE.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2019-05-07 12:53:15 +02:00
Greg Wilkins 6c6646286d cleanup after review
Signed-off-by: Greg Wilkins <gregw@webtide.com>
2019-05-03 15:25:05 +02:00
Greg Wilkins 604f2379bd cleanup dumps from review
Signed-off-by: Greg Wilkins <gregw@webtide.com>
2019-05-03 15:25:05 +02:00
Greg Wilkins aafb0fcec1 simplification after review
Signed-off-by: Greg Wilkins <gregw@webtide.com>
2019-05-03 15:25:05 +02:00
Greg Wilkins 1a76d487cc improved names and javadoc
Signed-off-by: Greg Wilkins <gregw@webtide.com>
2019-05-03 15:25:05 +02:00
Greg Wilkins feb0333844 Fixed IncludeExclude combination logic
Signed-off-by: Greg Wilkins <gregw@webtide.com>
2019-05-03 15:25:05 +02:00
Greg Wilkins 8b5f0211a8 parameterize include and exclude
Signed-off-by: Greg Wilkins <gregw@webtide.com>
2019-05-03 15:25:05 +02:00
Joakim Erdfelt 41ab9baf8c Standardizing on hamcrest Matchers (not CoreMatchers from junit4)
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
2019-04-30 14:39:57 -05:00
Joakim Erdfelt df716e1b23 Migrating away from junit5 deprecated isIn() to is(in())
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
2019-04-30 12:33:28 -05:00
Joakim Erdfelt 2b93a4e7ea Updating jetty-test-helper + junit5 + hamcrest
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
2019-04-30 12:23:55 -05:00
Joakim Erdfelt 734be56938 Updating to version 9.4.19-SNAPSHOT 2019-04-29 16:27:23 -05:00
Joakim Erdfelt e1bc35120a Updating to version 9.4.18.v20190429 2019-04-29 15:40:33 -05:00
Greg Wilkins f1d598acc6 Issue #3582 Fix toDetailString buffer modify
Signed-off-by: Greg Wilkins <gregw@webtide.com>
2019-04-29 16:59:26 +02:00
Greg Wilkins 5496f72a59 set reserved thread idle timeout
Signed-off-by: Greg Wilkins <gregw@webtide.com>
2019-04-29 16:33:08 +02:00
Jan Bartel ab174d1015
Issue #3597 Fix session persistence classloading for deep structures (#3602)
* Issue #3597 Fix session persistence classloading for deep structures with system classes.
2019-04-29 12:05:34 +02:00
Greg Wilkins 2562500c7b Merge branch 'jetty-9.4.x' into jetty-9.4.x-3550-QueuedThreadPool-cleanup 2019-04-29 07:42:06 +02:00
Greg Wilkins 3c51304b08 updates from review
Signed-off-by: Greg Wilkins <gregw@webtide.com>
2019-04-29 07:41:59 +02:00
Joakim Erdfelt 29b960551f Merge branch `release-9.4.17` into `jetty-9.4.x`
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>

# Conflicts:
#	jetty-bom/pom.xml
2019-04-25 09:15:42 -05:00
Greg Wilkins 3fd486737e Improve #3550 Use a TriInteger for larger range of threads
Signed-off-by: Greg Wilkins <gregw@webtide.com>
2019-04-25 12:50:05 +02:00
Greg Wilkins 704a97a6d2 Merge remote-tracking branch 'origin/jetty-9.4.x' into jetty-9.4.x-3550-QueuedThreadPool-cleanup 2019-04-25 06:53:07 +02:00
Greg Wilkins a3f6d3aeb6 Improve #3550 cleanup after review
Signed-off-by: Greg Wilkins <gregw@webtide.com>
2019-04-25 06:26:02 +02:00
Greg Wilkins ae2addc70a Issue #3550
Ensure that new threads are started if a thread exits due to failure.

Signed-off-by: Greg Wilkins <gregw@webtide.com>
2019-04-25 06:26:02 +02:00
lachan-roberts 42f2315518 Issue #3550 - start new thread on execute if there are no idle threads
previously if there were no idle threads, QueuedThreadPool.execute()
would just queue the job and not start a new thread to run it

Signed-off-by: lachan-roberts <lachlan@webtide.com>
2019-04-25 06:26:02 +02:00
Greg Wilkins 438f0b86a3 Issue #3550
Fixed QueuedThreadPool dump of known threads

Signed-off-by: Greg Wilkins <gregw@webtide.com>
2019-04-25 06:26:02 +02:00
Greg Wilkins ad40ba36a8 Merge branch 'jetty-9.4.x-3550-QueuedThreadPool-stalled' into jetty-9.4.x-3550-QueuedThreadPool-cleanup 2019-04-25 06:25:28 +02:00
Greg Wilkins a8b4ee3ed2 Merge branch 'jetty-9.4.x' into jetty-9.4.x-3550-QueuedThreadPool-stalled 2019-04-25 06:24:01 +02:00
Jan Bartel 41f9d7a95d Issue #3597 NPE in DumpableCollection
Signed-off-by: Jan Bartel <janb@webtide.com>
2019-04-25 06:16:51 +02:00
Greg Wilkins c66957867b Improve #3550 cleanup after review
Signed-off-by: Greg Wilkins <gregw@webtide.com>
2019-04-25 06:13:30 +02:00
Greg Wilkins 787380a91e Improve #3550 fix with a single Atomic
Signed-off-by: Greg Wilkins <gregw@webtide.com>
2019-04-24 22:20:32 +02:00
Greg Wilkins c4d51b09df Issue #3550
Ensure that new threads are started if a thread exits due to failure.

Signed-off-by: Greg Wilkins <gregw@webtide.com>
2019-04-24 11:42:23 +02:00
lachan-roberts f69de3372e Issue #3550 - start new thread on execute if there are no idle threads
previously if there were no idle threads, QueuedThreadPool.execute()
would just queue the job and not start a new thread to run it

Signed-off-by: lachan-roberts <lachlan@webtide.com>
2019-04-24 11:11:21 +02:00
Greg Wilkins 561ea0dafb Issue #3550
Fixed QueuedThreadPool dump of known threads

Signed-off-by: Greg Wilkins <gregw@webtide.com>
2019-04-24 09:33:14 +02:00
Joakim Erdfelt 05bb111580 Updating to version 9.4.18-SNAPSHOT 2019-04-18 15:59:49 -05:00
Joakim Erdfelt aa1c656c31 Updating to version 9.4.17.v20190418 2019-04-18 14:44:28 -05:00
Joakim Erdfelt 5882d63ba7 Updating to version 9.3.28-SNAPSHOT 2019-04-18 13:54:17 -05:00
Joakim Erdfelt d3e249f869 Updating to version 9.3.27.v20190418 2019-04-18 13:10:03 -05:00
Joakim Erdfelt 2c14d93885 Updating to version 9.2.29-SNAPSHOT 2019-04-18 12:17:07 -05:00
Joakim Erdfelt 1dffa36fe3 Updating to version 9.2.28.v20190418 2019-04-18 11:23:17 -05:00
Joakim Erdfelt c75136fe63 Merge branch 'release-9.4.16' into jetty-9.4.x 2019-04-18 10:13:20 -05:00
Joakim Erdfelt 2995029c98 Merge branch `jetty-9.3.x` into `jetty-9.4.x`
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>

# Conflicts:
#	jetty-client/src/test/java/org/eclipse/jetty/client/HttpClientTest.java
#	jetty-client/src/test/java/org/eclipse/jetty/client/HttpClientURITest.java
#	jetty-fcgi/fcgi-server/src/test/java/org/eclipse/jetty/fcgi/server/AbstractHttpClientServerTest.java
#	jetty-fcgi/fcgi-server/src/test/java/org/eclipse/jetty/fcgi/server/HttpClientTest.java
#	jetty-proxy/src/test/java/org/eclipse/jetty/proxy/ConnectHandlerTest.java
#	jetty-server/src/main/java/org/eclipse/jetty/server/handler/DefaultHandler.java
#	jetty-servlet/src/test/java/org/eclipse/jetty/servlet/DefaultServletTest.java
#	jetty-util/src/main/java/org/eclipse/jetty/util/resource/Resource.java
#	pom.xml
2019-04-17 17:10:53 -05:00
Joakim Erdfelt 3d028ab2ca Issue #3549 - Using FileName properly in Directory Listings.
+ Even though this was reported against Windows, the solution
  implemented should be sane for all OS or FileSystem combinations.

Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
2019-04-15 18:05:48 -05:00
Joakim Erdfelt 7b774d82e8 Issue #3549 - Using FileName properly in Directory Listings.
+ Even though this was reported against Windows, the solution
  implemented should be sane for all OS or FileSystem combinations.

Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
2019-04-15 18:01:41 -05:00
Simone Bordet 3f0ec633a1 Issue #3464 - Split SslContextFactory into Client and Server
Fixed instanceof check to maintain backwards compatibility.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2019-04-15 15:57:37 +02:00
Joakim Erdfelt 79537a5f51 Updating to version 9.4.17-SNAPSHOT 2019-04-11 11:00:24 -05:00
Joakim Erdfelt e0aa4ae4c0 Updating to version 9.4.16.v20190411 2019-04-11 10:01:26 -05:00
Joakim Erdfelt 20343ba7cb
Merge pull request #3542 from eclipse/jetty-9.4.x-issue-3540-ssl-provider-consistency
Issue #3540 - Use configured Security Provider consistently
2019-04-10 08:16:03 -07:00
Joakim Erdfelt 1532eba61d Issue #3319 - Fixing sorting of listings
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
2019-04-10 10:15:21 -05:00
Joakim Erdfelt 0efa519553 Issue #3540 - Use configured Security Provider consistently
+ If optional Security Provider is configured, then use it consistently
  for all security objects that take a Provider argument.

Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
2019-04-10 08:22:16 -05:00
bkmz e41906fbdb Bug and build fixes:
- Fixes deflater/inflater pool validation
- Removes validation tests of Flators for pool
- Eroding pool usage; fixes cleanup of Deflaters

Signed-off-by: bkmz <ilya.cherkasov@gmail.com>
2019-04-07 21:23:31 +03:00
Simone Bordet 97d501d444 Merged branch 'jetty-9.4.x' into 'jetty-9.4.x-3361-thread-safe-setHandlers'. 2019-04-05 08:47:34 +02:00
Simone Bordet a982422b40 Issue #3494 - QueuedThreadPool bug - jobs disappearing on lifecycle stop.
Small fixes after review.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2019-04-05 08:36:18 +02:00
Simone Bordet 3dd58fae22
Merge pull request #3520 from lachlan-roberts/jetty-9.4.x-queuedThreadPoolBug
QueuedThreadPool bug - jobs disappearing on lifecycle stop #3494
2019-04-05 08:32:22 +02:00
Greg Wilkins db60003099 Issue #3481 TLS Close
Updates from review:
 - cleanup isEmpty logic

Signed-off-by: Greg Wilkins <gregw@webtide.com>
2019-04-05 17:20:43 +11:00
Greg Wilkins 33e3894796 Issue #3481 TLS Close
Updates from review:
 - shutdown after flush
 - close if write fails

Signed-off-by: Greg Wilkins <gregw@webtide.com>
2019-04-05 17:20:43 +11:00
Joakim Erdfelt 9b19374c5d Updating to version 9.2.28-SNAPSHOT 2019-04-03 19:38:05 -05:00
olivier lamy ebd676df5d fix header
Signed-off-by: olivier lamy <oliver.lamy@gmail.com>
2019-04-04 10:16:56 +10:00
Joakim Erdfelt 84dfe74b97 Updating to version 9.2.27.v20190403 2019-04-03 19:04:45 -05:00
Lachlan Roberts 1097354611 Issue #3494 - QueuedThreadPool changes from review
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2019-04-04 10:46:54 +11:00
Joakim Erdfelt c70034766e Updating to version 9.3.27-SNAPSHOT 2019-04-03 18:46:31 -05:00
Joakim Erdfelt dae476e369 Updating to version 9.3.26.v20190403 2019-04-03 18:16:32 -05:00
Joakim Erdfelt 2ccde9772b Undoing bad release-9.3.26 2019-04-03 18:11:16 -05:00