* 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>
- do not select duplicate extensions in javax default Configurator
- correctly copy payload for ping frames in jetty & javax frame handlers
- add ByteBuffer to javadoc for onMessage in jetty api
- cleaned up some test logging for EventSocket
- add autoFragment and maxFrameSize settings to WebSocketPolicy
- fix early validation for multiple extensions in setExtensions
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
* Issue #3734 - throw ISE for WebSocket suspend after close
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
* Issue #3734 - suspend is error if onClose() has been called
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
Outgoing frames will now go RemoteEndpoint->Session->ExtensionStack
instead of just RemoteEndpoint->ExtensionStack.
This will allow the Session to check whether it has been closed before
allowing the frame through the ExtensionStack.
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
* Issue #3872 Javax Websocket Packaging
Moved JaxaxWebSocketConfiguration and SCI to config package.
Limited classpath exposure in JavaxConfiguration (more needed)
Updated tests with work around for those that needs more classes exposed
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* Issue #3872 Javax Websocket Packaging
Moved all remaining classes from org.eclipse.jetty.websocket.javax.server
to org.eclipse.jetty.websocket.javax.server.internal.
This works when running on the classpath, but the tests fail when running
on the modulepath (eg in commandline mvn run). The issue appears to be
that the tests don't load test classes from WEB-INF/lib or WEB-INF/classes.
Instead the test classes were themselves in org.eclipse.jetty.websocket.javax.server,
which is no longer exported from module-info.java.
The hacked "fix" for this has been to create a org.eclipse.jetty.websocket.javax.server.tests
package which is exported and to move all the tests to that. A better fix is needed.
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* Issue #3872 Javax Websocket Packaging
improve comments
tighten exposed classes more
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* Issue #3872 - fixing tests
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
* Issue #3872 - move ContainerDefaultConfigurator to config package
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
* Issue #3873 - fix javax websocket test classloader issues
move websocket endpoints for test webapps to com.acme.websocket package
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
+ This class is removed in Jetty 10 anyway.
+ If all you want is to access available extension names
then use the Factory.getAvailableExtensionNames() method
(which exists in Jetty 10.0.0 as well)
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
+ The change in commit 30dc103a12
was done to allow the InflaterPool and DeflaterPool
to be managed by the Jetty lifecycle.
+ This restore the original abstract class ExtensionFactory.
+ Had to break the traditional LifeCycle usage for a more
non-traditional one in order to both, not break this existing
API, and not introduce jetty-util to the webapp classloader.
+ This will restore API / binary compatibility for other
projects, like spring-boot.
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
* 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>
* fix flaky test ClientCloseTest.testStopLifecycle() in 9.4.x
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
* test code cleanups in ClientCloseTest
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
* Issue #3968 - websocket suspend fix and cleanups
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
* Issue #3968 - fixed race conditions when using websocket ReadState
combine the previous ReadMode into ReadState by using ReadState.Action
which is returned from ReadState.getAction(ByteBuffer) where an atomic
decision is made of what action to do
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
Fixes#250 - Implement HTTP CONNECT for HTTP/2.
Modified HTTP/2 implementation to support the CONNECT method.
Implemented semantic defined by RFC 8441.
Implemented section 8.3 of RFC 7540.
Introduced HTTP2Client.streamIdleTimeout.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Updated server-side to use direct/heap ByteBuffers based on
getters and setters in the relevant components.
Made HTTP/1.1, HTTP/2, and WebSocket use the same mechanism.
Removed unused obsoleted methods:
* EndPoint.isOptimizedForDirectBuffers()
* HttpTransport.isOptimizedForDirectBuffers()
* HttpOutput.Interceptor.isOptimizedForDirectBuffers()
* HttpChannel.useDirectBuffers()
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
+ Test cases have been updated based on PR review
+ Fixing merge from `jetty-9.4.x` that caused a duplicate
JettyListenerEventDriver.onContinuationFrame() method
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
+ If an annotated Jetty WebSocket Endpoint doesn't have
a handler for data types TEXT or BINARY then the
new NullMessage (sink) is used for that specific data type
to consume (quietly) those ignored Messages.
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
* Issue #2061 - fail current entry in CompressExtension on failure
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
* Issue #2061 - do not notify callback failure twice
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
* Issue #3159 - do not copy RSV bits to auto-fragmented frames
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
* Issue #3159 - warn if DeflateFrameExtension detects autoFragment on
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
* Issue #3159 - automatically set auto-fragment false in DeflateFrameExt
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
* Issue #3159 - automatically set auto-fragment false in DeflateFrameExt
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
* Issue #3159 - add todo
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
* Issue #3809 - ensure abnormal close frame will hard close ws connection
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
* Issue #3159 - signal onError on abnormal status code close
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
* fix javadoc generation with jdk11
Signed-off-by: olivier lamy <oliver.lamy@gmail.com>
* currently disable javadoc:aggregate-jar as do not work yet
Signed-off-by: olivier lamy <oliver.lamy@gmail.com>
* reworked WebSocket autobahn test code and the core MessageHandler
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
* PR #3802 - changes from review
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
* 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>
* Issue #3661 - review of exposed classes in jetty-websocket-server
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
* Issue #3762 - cleanups of jetty-websocket-server
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
* Issue #3762 - use the default port of 0 for WebSocket tests
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
* Issue #3762 - use system property to set custom port in xml
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
* Issue #3705 - notify WebSocket framehandler on client upgrade failure
getFrameHandler on the ClientUpgradeRequest no longer takes
the upgrade response, the response must be set later if it is
required by the framehandler implementation
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
* Issue #3705 - changes from review
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
* Issue #3705 - throw if FrameHandler could not be created
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
* wip
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
* Issue #3705 - count down the onOpen latch in NetworkFuzzer
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
* Issue #3705 - WebSocket Session CompletableFuture refactor
- sessionFutures for jetty and javax are now implemented using the
futureCoreSession which will occur after onOpen
- the request and response are set on the FrameHandler before the
upgrade
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
the WebSocket suspend after close different behaviour from 9 to 10
in jetty-10 an ISE is thrown
in jetty-9 it is a no-op
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
+ Added new SCIOnStartupListener that allows for manual wiring up
of ServletContainerInitializers (with no bytecode scanning)
in embedded jetty usages
+ Introduced .initialized(context) and .configure(context) to both of
the websocket SCIs
+ Moved ClientConnectTest to jetty-websocket-tests
+ Moved WebSocketClientTest to jetty-websocket-tests
+ Made moved tests not use BlockheadServer
+ Made moved tests use new .configure(context, lambda) methods
+ Also allowing javax.websocket.server SCI implementation to
add ContextDestroyListener during the execution of another
ServletContextListener.
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>