* 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>
+ 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>
+ 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>
* 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>
+ 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>
+ Those methods and constructors that had @Deprecation assigned
that urged the use of HttpClient directly are no longer
annotated as deprecated because of legitimate possibility of
a valid LinkageError
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
+ 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>
- 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>
Introduced SslContextFactory subclasses Client and Server.
Replaced all usages of SslContextFactory with either Client or Server
as required.
Refactored configuration checking so that warnings are not emitted
when non necessary.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
+ Any schedulers created are named (for ease of debug) and daemon
so they do not stop the JVM exiting.
+ If the server.doStart() fails, it calls server.doStop to ensure
connectors are stopped, ports are free etc.
+ cleanup of addBean handling of scheduler in proxy
Signed-off-by: Greg Wilkins <gregw@webtide.com>
+ FrameFlusher "close" frames are detected during
enqueue and sets the state properly for failing
other frames after it
+ Moving away from Blockhead(Client|Server) to using actual implementations
+ Moved tests to /jetty-websocket-tests/ to be able to use actual impl
for both sides of testcase (client and server)
+ Corrected FrameFlusher terminate/close to not fail the close frame
itself, but only frames that arrive AFTER the close frame.
+ Moving WebSocketCloseTest to jetty-websocket-tests to avoid
using BlockheadClient / BlockheadServer in testing
+ Cleanup of unnecessary modifiers on interface
+ Logging error if @OnWebSocketError is undeclared
+ IOState removed
+ New ConnectionState tracks connection basics in a simpler
method then IOState did.
+ No tracking of Remote close initiated (not needed)
+ IncomingFrames.incomingError() removed
+ Session delegates to Connection for all state changes
+ Errors can be communicated to application multiple times
+ Close is only communicated once
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
Updating SslContextFactory configuration for tests, since
the change in the default endPointIdentificationAlgorithm
makes the test failing as the certificates are not valid
for the local host, which is different depending on where
the tests are run (locally, jenkins).
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Revert to the not-so-good bean handling for the HttpClient executor
Added TODOs so that the bean handling can be updated in future.
Deprecated Websocket client setters that hide dependency on internal HttpClient instance.
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* Cleanup the dump implementation
* improved the clarity of utility methods for dump and updated most dump methods
* fixed upgrade filter dump
* Improved dump after review
* Moved dumpObjects to Dumpable
* implemented dumpBeans with dumpObjects
* less verbose dump
* Dump streams
* fixed dump test
Signed-off-by: Greg Wilkins <gregw@webtide.com>
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
+ Using HttpClient fixes from #2901 to allow upgrader to be
held for entire conversation regardless of authentication
or redirect behaviors.
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
+ Changes needed for new Junit 5
+ Migrating from Vintage junit API to Jupiter junit API
+ Relies on SNAPSHOT jetty-test-helper
- this will be a formal release once this issue has been
resolved satisfactory
+ Have jenkins always pull latest SNAPSHOT for each build
+ Adding jetty.snapshots repository
+ Using surefire 2.22.0 per advice from junit
+ Ensuring <reuseForks>true</reuseForks> to work around issue junit-team/junit5#801
+ Disabling <forkMode>always</forkMode> in maven-surefire-plugin
due to bug https://github.com/junit-team/junit5/issues/801
+ OSGi tests must remain at vintage due to PaxExam
+ Moving from vintage TestingDir to jupiter WorkDir
+ Fixing imports to use jupiter, not vintage
+ Migrating vintage ExpectedException to jupiter assertThrows
+ Migrating vintage TestName to jupiter TestInfo
+ Migrating @RunWith(Parameterized.class)
to @ParameterizedTest with Argument Sources
+ Migrating assertTrue(val.contains(needle))
to assertThat(val, containsString(needle))
+ Aligning junit versions per recommendations from @sormuras
+ Adjusting parameter order change for assertEquals()
+ Test LifeCycle Annotation Migration
junit 4 | junit 5 / jupiter
------------ | -----------
@Before | @BeforeEach
@After | @AfterEach
@BeforeClass | @BeforeAll
@AfterClass | @AfterAll
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
Signed-off-by: olivier lamy <oliver.lamy@gmail.com>
+ Added Client unit tests for large messages
+ Re-enabled Server unit tests for large messages
+ Added more Server unit tests for large messages
+ In case of JSR356 Server with policy (and Behavior of SERVER)
is controlling javax.websocker.server.ServerContainer
and a user chooses to use that ServerContainer to
connect to a remote websocket endpoint (using ServerContainer
as a client), then the policy is delegated down to the
Client Container with a different behavior (only).
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
Fixes the dynamic imports of `org.eclipse.jetty.websocket.server` and `org.eclipse.jetty.websocket.server.pathmap` as explained in the issue #2694 proposition 2. (previously the content of `org.eclipse.jetty.websocket.server` was not imported)
Signed-off-by: Clément Delgrange <cl.delgrange@protonmail.com>
+ WebSocketClient all constructors now delegate down into one
implementation
+ NativeWebSocketServletConfiguration is now managed properly
+ WebSocketServletFactory can find Executor as bean too
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
+ Correcting Native WebSocketConfiguration impact.
+ CDI requires a customized DecoratedObjectFactory, which is bound
later in the lifecycle, which means we cannot rely on it being
provided directly in the constructors, but rather have to look
for it in the ServletContext.
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
+ Assigning WebSocket Client to use true for direct bytebuffers always.
+ Changes from review with @sbordet
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
Reworked MisbehavingClassTest to fix sections of unreachable code causing exception stack traces to be logged.
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>