On the client:
* Origin.Address.host is passed through HostPort.normalizeHost(),
so that if it is IPv6 is bracketed.
Now the ipv6 address passed to an `HttClient` request is bracketed.
* HttpRequest was de-bracketing the host, but now it does not anymore.
On the server:
* Request.getLocalAddr(), getLocalName(), getRemoteAddr(),
getRemoteHost(), getServerName(), when dealing with an IPv6 address,
return it bracketed.
The reason to return bracketed IPv6 also from *Addr() methods is that
if it is used with InetAddress/InetSocketAddress it still works, but
often it is interpreted as a URI host so brackets are necessary.
* DoSFilter was blindly bracketing - now it does not.
Added a number of test cases, and fixed those that expected
non-bracketed IPv6.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
* Issue #5093 Static UrlEncoded
Updated UrlEncoded to static only class with no synchronization
* Fixed additional tests
* fixed formatting
Signed-off-by: gregw <gregw@webtide.com>
* Replaced relevant usages of synchronized with AutoLock.
* Made AutoLock serializable since classes that use it may be stored in the HttpSession.
* Added convenience methods to AutoLock to execute lambdas with the lock held.
* Introduced AutoLock.WithCondition to use a Lock and a Condition together.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
* Fixes#5057 Included root context path
Root context path in include should be empty string.
* Issue #5057
merged context path methods as result of review.
ServletContent.getContextPath now returns the encoded contextPath (if anybody is silly enough to have one).
In jetty-10, the Container.Listener is also dumped as a bean, whereas it is not in
jetty-9. The test was checking that nothing was dumped as a bean, so
changed the test to explicitly look for the special formatting for
listeners, filters and servlets.
* Issue #4741 HttpServletMapping
This completes the refactoring started in #4851, using
the HttpServletMapping field to avoid having the servletPath field
in the Request and instead have a pathInContext field.
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* Issue #4741 HttpServletMapping
reverted ResourceService changes
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* Issue #4741 HttpServletMapping
fixed gzip handler
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* Issue #4741 HttpServletMapping
Fixed several TODOs left in the code
removed _contextPath field and used an attributes lookup for include
replaced setContextPaths with setContext
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* Issue #4741 HttpServletMapping
Used the same pattern from the contextPath changes for servletPath and pathInfo. Now the servletPathMapping is always set on the request and only if the dispatch is an include do the effected methods look deeper for the source values.
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* Issue #4741 HttpServletMapping
Improved javadoc
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* Issue #4741 - fixes to jetty implementation of HttpServletMapping
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
* Issue #4741 - don't lazily generate HttpServletMapping to preserve servletName
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
* Issue #4741 - tests should expect no leading / for matchValue
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
* resolving TODOs from review
- removed pathSpec from Request
- getServletMapping moved to ServletHandler
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
* Issue #4741 - only create HttpServletMapping for exact matches once
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
* use wrapped attributes for async dispatch
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
* Issue #4741 - Changes from review, revert async attribute wrapping
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
* Issue #4741 - Changes from review
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
* Issue #4741 Async ServletMapping
Greatly increased the scope of this PR by combining the servletPath and
pathInfo into the ServletPathMapping class that implements the
HttpServletPathMapping interface. This allows us to greatly simplify
the matching of servlets and reduce the number of times we need to
actually to the match per request.
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* Issue #4741 Async ServletMapping
Fixed problems with previous commit
more cleanup of attributes in dispatcher.
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* Issue #4741 Async ServletMapping
More code cleanups
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* Issue #4741 Async ServletMapping
Named dispatch cleanup
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* Issue #4741 Async ServletMapping
misc cleanup
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* Issue #4741 Async HttpServletMapping
Added tests for named dispatchers
Do not use ServletPathMapping for named dispatch
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* Issue #4741 Async HttpServletMapping
renamed confusing isDefault method on ServletMapping
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* Issue #4741 Async HttpServletMapping
simplified setAttribute
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* Issue #4741 Async HttpServletMapping
added javadoc about AsyncAttributes
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* Issue #4741 Async HttpServletMapping
Fixed javadoc
Signed-off-by: Greg Wilkins <gregw@webtide.com>
Co-authored-by: Greg Wilkins <gregw@webtide.com>
Introduced:
* Request Request.headers(Consumer<HttpFields.Mutable>).
This allows applications to modify the headers, and chain calls.
It also delegates the precise semantic of put/add/remove/clear to HttpFields, so there is no API duplication.
* HttpRequest.header(HttpField) to efficiently add fields while normalizing the request (only used in implementation).
* HttpResponse.header(HttpField) to efficiently add fields while parsing the response (only used in implementation).
This pairs with HttpResponse.trailer(HttpField).
* HttpResponse.headers(Consumer<HttpFields.Mutable>) to modify the fields after they have been populated (only used in tests).
Removed:
* Request.[set,add,put,remove], replaced by headers(Consumer<HttpFields.Mutable>).
Deprecated:
* Request.header(String, String)
* Request.header(HttpHeader, String)
Both replaced by headers(Consumer<HttpFields.Mutable>) with clearer semantic for add/put/remove.
All the rest is code cleanup to remove the usage of the deprecated header() methods.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
* Use HandlerList instead of HandlerCollection
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* Use HandlerList instead of HandlerCollection
Signed-off-by: Greg Wilkins <gregw@webtide.com>
Restored IncludedGzipTest.
Fixed ServletContextHandler.relinkHandlers(), now excluding
the checks for GzipHandler.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Fixed XML files.
Restored ServletContextHandler.setGzipHandler() and
deprecated it in case it's used from user's XML files.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
* Issue #4713 Async dispatch with query.
+ Preserve the entire URI with query when startAsync(req,res) is used.
+ merge any query string from dispatch path with either original query or preserved query from forward
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* Issue #4713 asyncDispatch with query parameters
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* Issue #2074 Do not merge query strings
Do not merge the query string itself, only the parameter map.
The query string is either the original or replaced by the one from the dispatch.
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* Issue #4719 Keep previous charencoding if not set in content type
Signed-off-by: Jan Bartel <janb@webtide.com>
* Issue #4719 - Adding unit tests for charset reset/change
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
* Issue #4713 Async dispatch with query.
+ Preserve the entire URI with query when startAsync(req,res) is used.
+ merge any query string from dispatch path with either original query or preserved query from forward
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* Issue #4713 asyncDispatch with query parameters
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* Introducing jetty-slf4j-impl
* Make Jetty use org.slf4j
* Removed most of org.eclipse.jetty.util.log classes
* Left org.eclipse.jetty.util.log.Log and
org.eclipse.jetty.util.log.Logger but as
simple bridge classes that are deprecated
* Migrated code using org.eclipse.jetty.util.log.StacklessLogging
to org.eclipse.jetty.logging.StacklessLogging found in
the jetty-slf4j-impl
* Moved logging start modules from jetty-util to jetty-home
* Simplified logging start modules
* Updated code that was using StdErrLog directly
* Updating module-info.java for org.slf4j
* removing org.eclipse.jetty.util.log.class references
* jetty-start supports manually declared default provider
+ and we use it to default "logging" to the "logging-jetty" provider
* Cleaning up jetty-maven-plugin and IT testing for Logging
* Using old slf4j for it testing
* Updating compiler config to show Xlint:exports warnings
* Updating console-capture and logging-noop
* Adding slf4j bridge (capture) jetty modules
* Updates to jetty logging module locations
* Changing reference to slf4j dependent mod
* Process requested enabled modules in topological order
* Limiting inclusions in shaded jetty-start
+ Also adding note to jetty-util classes that are used by
jetty-start
* Default logging level on baseline logging config is INFO (not DEBUG)
* Changing from system to server classes in logging
* Updating other modules to use new logging names
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
Introduced Request.Content with a reactive model to provide
request content.
Introduced RequestContentAdapter to wrap ContentProviders
into Request.Content.
Updated implementation to use the reactive model rather than
the old pull model.
Reimplemented all ContentProviders in terms of Request.Content.
Converted most of the tests from ContentProvider to Request.Content.
Updated proxy servlets and documentation.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
* Issue #4533 Hard close from Dispatcher
Signed-off-by: Greg Wilkins <gregw@webtide.com>
#4533 Do hard close from Dispatcher so response wrappers may intercept close.
* Issue #4533 Hard close from Dispatcher
Signed-off-by: Greg Wilkins <gregw@webtide.com>
#4533 improve test after review
* Issue #4533 Hard close from Dispatcher
Some renaming of methods to make it clear that softClose should only be used as part of sendError handling. If softClose is used by other components, then sendError can be prevented from setting the error status.
Signed-off-by: Greg Wilkins <gregw@webtide.com>
Moved multipart classes to jetty-server.
Updated jetty-http's pom.xml and module-info.java
removing the dependency on Servlet APIs.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
* Avoid creating listener list for rarely used requestAttributeListener
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* Issue #3964
Keep a list of EventListeners in the AbstractConnector to make it
more efficient to add and iterate over them.
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* Issue #2578 EventListener
Use addEventListener rather than bespoke listener methods.
Support getEventListenerBeans at Container level for fast lookup
improve javadoc
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* Issue #2578 EventListener
fixed test
more javadoc
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* Issue #2578 EventListener
fixed tests
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* Issue #3964
Don't use null for empty lists of listeners
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* fix merge
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* Issue #2578 EventListener
Resolve differences between eventListeners added as beans and beans
added as EventListeners. The behaviour should now be the same
regardless of how they listener is added and all listeners are now
beans.
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* Issue #2578 EventListener
Add only SelectorManager listeners to manager from connector
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* Issue #2578 EventListener
Fixed javadoc
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* Issue #2578 EventListener
removed old TODO
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* Issue #2578 EventListener
connector cannot be null
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* Issue #2578 EventListener
javadoc
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* Issue #3964
AbstractConnector keeps a specific list of HttpChannel.Listeners
to avoid Connection.Listeners and MBean listeners being added to
the HttpChannel listener list.
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* Issue #2578 EventListener
fixed merge
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* fixed javadoc
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* Issue #2578 EventListener
removed the ability to set/clear context listeners
Instead just remove non-durable ones.
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* Issue #3964 Listeners
Simplified listener handling by avoiding null connector, previously
only needed for testing.
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* fixed bad merge
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* Issue #3964 Listeners
Fixed test that assumed HttpChannel listeners were not cleared by a recycle
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* Issue #3964 Listeners
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.
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* removed deprecated cyclic HttpChannel listeners
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* removed deprecated cyclic HttpChannel listeners - import
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* Issue #4003 Cleanup quickstart
* Fixed tests that scan for "Started" on console
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* updates from review
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* Issue #4188 Spin in close of GzipHandler
Cleanup and simplify code
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* Issue #4188 Spin in close of GzipHandler
Fix slice code. Added unit test for it.
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* Issue #4188 Spin in close of GzipHandler
Fixed last slice.
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* cleanup from review
Signed-off-by: Greg Wilkins <gregw@webtide.com>