Commit Graph

69 Commits

Author SHA1 Message Date
Simone Bordet 0018c298dc
Merge pull request #4845 from eclipse/jetty-10.0.x-4808-review_httpclient_header_api
Fixes #4808 - Review HttpClient Request header APIs.
2020-05-08 17:52:51 +02:00
Lachlan 2e1c01ac8c
Merge pull request #4723 from eclipse/jetty-10.0.x-WebSocketServlet
Issue #4722 - remove websocket-servlet
2020-05-07 22:45:04 +10:00
Simone Bordet cf9df70935 Fixes #4808 - Review HttpClient Request header APIs.
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>
2020-05-04 23:16:59 +02:00
Lachlan Roberts e5cca92199 Merge remote-tracking branch 'origin/jetty-10.0.x' into jetty-10.0.x-WebSocketServlet
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2020-05-01 15:46:03 +10:00
Lachlan Roberts b0e57ffd6d Merge remote-tracking branch 'origin/jetty-10.0.x' into jetty-10.0.x-LinkageErrorInvestigation 2020-04-29 22:52:33 +10:00
Lachlan Roberts bf5d4ea554 Issue #4800 - Revert MethodHandle changes & update DistributionTests
- It seems it is correct to use the `MethodHandles.publicLookup().in()`
but this does not work if same webapp is deployed twice, so the
MethodHandle changes have been reverted and the test has been disabled
until a resolution to https://bugs.openjdk.java.net/browse/JDK-8244090.

- The DistributionTest has been changed to properly reproduce the issue.
There must be a class in the signature of the websocket endpoint which
is available to both webapps and the client must send and receive an echo
message to ensure that the onOpen MethodHandle is actually invoked.

Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2020-04-29 22:52:26 +10:00
Greg Wilkins 8c7e34f37d
Jetty 10.0.x immutable meta data (#4777)
Made HttpURI, HttpFields and MetaData immutable.  The first two follow the same builder pattern and MetaData is constructor injection only.

* Immutable version of HttpFields

Preserve API and usage of HttpFields class while providing a read only interface and immutable implementation.

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

* Immutable version of HttpFields

Use an ArrayList in HttpFields. While slightly slower than the array, it will mostly be used as a builder pattern for an Immutable

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

* Immutable version of HttpFields

Fixed exception type.

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

* Immutable version of HttpFields

asImmutable method

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

* Immutable MetaData

Made HttpURIU immutable with a builder pattern.
MetaData immutable and working within http module.

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

* Immutable MetaData

Fixes from review

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

* Immutable MetaData

Passing tests upto and including jetty-server

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

* Immutable MetaData

Cleanup of HttpURI.Builder API as suggested in PR.

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

* Immutable MetaData

Added builder for MetaData.Request

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

* Immutable MetaData

more api fixes

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

* Immutable MetaData

WIP making HttpFiels itself immutable.  Currently working up to jetty-servlet.

Need to consider if content-length really is meta data and how much and when can we trust it.

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

* Immutable MetaData

WIP

Need to consider if content-length really is meta data and how much and when can we trust it. Also need to consider difference between h2 and h1 authority in metadata.

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

* Immutable MetaData WIP

jetty-client and jetty-servlet passing tests.

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

* Immutable MetaData WIP

Better align the style of immutability between `HttpFields` and `HttpURI`.
They both now have static build() and from() methods, plus Builder and Immutable implementations.
Potentially `Builder` could be renamed as `Mutable`

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

* Immutable MetaData WIP

http2-server tests passed

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

* Immutable MetaData WIP

http2-client tests passed

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

* Immutable MetaData WIP

cleann build?

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

* Immutable MetaData WIP

fix

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

* Immutable MetaData WIP

more test fixes

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

* Immutable MetaData WIP

Cleanups, mostly using EMPTY when appropriate.

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

* Immutable MetaData WIP

Cleanups, use immutable

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

* Immutable MetaData WIP

No trailers for connect

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

* Immutable MetaData WIP

Fix CONNECT path handling

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

* Immutable MetaData WIP

fixed rewrite query handling

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

* Immutable MetaData WIP

rename Builders to Muttables

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

* Immutable MetaData WIP

misc cleanups

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

* Immutable MetaData WIP

Revert to using arrays due to garbage generated by streams and iterators (12% of a simple benchmark!).
Even if this garbage is an artifact of the JIT being disabled by observation, it can hide other allocations, so best to just use simple arrays!

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

* Immutable MetaData WIP

More optimizations and better test coverage.

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

* Immutable Metadata

various cleanups

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

* Immutable MetaData WIP

More optimizations

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

* Immutable MetaData WIP

review changes

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

* Immutable MetaData WIP

changes after review:
 + less usage of Mutable
 + more usage of EMPTY
 + restored fragment handling

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

* Immutable MetaData WIP

changes after review:
 + less usage of Mutable
 + less usage of asImmutable

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

* Immutable MetaData WIP

changes after review:
 + less usage of Mutable

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

* Immutable MetaData

changes after review:
 + better handling of URI in ContextHandler

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

* Immutable MetaData

changes after review:
 + downcast in test to access mutable response headers.

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

* Immutable MetaData

changes after review:
 + use put instead of add for one time headers

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

* private

Signed-off-by: Greg Wilkins <gregw@webtide.com>
2020-04-28 13:36:44 +02:00
Lachlan Roberts 64beae3382 Issue #4800 - test both cases individually
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2020-04-24 20:16:19 +10:00
Lachlan Roberts fb85c71f8d Issue #4800 - invalid PathParam types should be reported at Deployment
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2020-04-24 17:11:23 +10:00
Lachlan Roberts f5b0dc56d2 Issue #4800 - Reproduce LinkageError in WebSocket unit test
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2020-04-24 13:14:42 +10:00
Lachlan Roberts 7c2d804ce9 Change the WSServer to allow deployment of multiple webapps
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2020-04-24 10:18:24 +10:00
Lachlan Roberts 6ee0f2ebbc Merge remote-tracking branch 'origin/jetty-10.0.x' into jetty-10.0.x-WebSocketServlet 2020-04-23 13:53:10 +10:00
Lachlan Roberts c6e58e693b Issue #4747 - changes from review
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2020-04-22 18:10:49 +10:00
Lachlan Roberts b58697817f Issue #4722 - create new module websocket-util-server
- This module contains the WebSocketUpgradeFilter.
- Also has an internal package with the components used
  to implement websocket upgrades common to both the
  jetty and javax websocket implementations.

Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2020-04-22 17:26:46 +10:00
Joakim Erdfelt d1163261a0
Merge remote-tracking branch 'origin/jetty-10.0.x' into jetty-10.0.x-4747-WebSocketTCK 2020-04-21 09:07:31 -05:00
Lachlan f23236b09d
Merge pull request #4775 from eclipse/jetty-10.0.x-4771-WebSocketMessageHandlerTests
Issue #4771 - cleanup and add tests for the unused ws message handlers
2020-04-20 08:43:39 +10:00
Greg Wilkins 2addb6a655
Jetty 10.0.x use HandlerList instead of HandlerCollection (#4757)
* 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>
2020-04-15 18:42:28 +02:00
Lachlan Roberts 4047e31ce7 Issue #4771 - cleanup and add tests for the different ws message handlers
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2020-04-15 10:50:27 +10:00
Lachlan Roberts 4e69b48344 Issue #4747 - filter out synthetic annotated methods
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2020-04-08 15:31:42 +10:00
Lachlan Roberts 625dfd1a4d Issue #4747 - Fix WS path params to work within a context path
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2020-04-07 12:18:29 +10:00
Lachlan Roberts 54ee3f3939 Issue #4747 - Throwing in onClose now calls onError
- This applies to the javax onClose method not the core onClosed method.
- Also fixes a bug where onClosed may never be called if onFrame throws.

Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2020-04-06 20:28:57 +10:00
Lachlan Roberts 664cb81e6d Issue #4747 - Default close status code should be normal status
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2020-04-06 07:48:14 +10:00
Lachlan Roberts 89c4504d07 Issue #4722 - remove websocket-servlet
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2020-03-27 16:31:37 +11:00
Lachlan Roberts 04cc21fe40 Issue #4691 - use static methods with javadoc to get MethodHandle lookup
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2020-03-23 16:43:09 +11:00
Simone Bordet 10f4fda0de Issue #4691 - Use MethodHandles.lookup() consistently in WebSocket code.
* Using MethodHandles.publicLookup().in(...) instead of privateLookupIn(...).
* Moved test WebSocket EndPoint classes into the proper package, otherwise
  they would not be accessible because the test package is not exported.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2020-03-22 16:42:13 +01:00
Joakim Erdfelt e385dea838
Do not deploy websocket test projects
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
2020-03-20 14:04:04 -05:00
Joakim Erdfelt 43419802b7
Issue #4685 - Declare <scope> for jetty-slf4j-impl everywhere
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
2020-03-20 11:12:08 -05:00
Joakim Erdfelt 9492a5379c
Issue #4685 - eliminate <version> in jetty-slf4j-impl
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
2020-03-20 10:42:36 -05:00
Joakim Erdfelt a16abe1693
Issue #4685 - jetty-slf4j-impl not a compile/runtime dependency.
+ Mark as a test dependency

Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
2020-03-19 17:46:41 -05:00
Olivier Lamy 0541c5efb4
fix javadoc aggregate generation by using last maven javadoc plugin 3.2.0 (#4675)
Signed-off-by: olivier lamy <oliver.lamy@gmail.com>
2020-03-19 07:06:13 +10:00
Lachlan Roberts e050160101 Merge branch jetty-10.0.x into jetty-10.0.x-WebSocket-JPMS
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2020-03-17 11:07:29 +11:00
Joakim Erdfelt 57604d0955
Issue #4572 - Mechanical Change to use org.slf4j
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
2020-03-16 15:48:25 -05:00
Joakim Erdfelt 8b7e64915f
Issue #4572 - Replace Jetty Logging with SLF4J
* 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>
2020-03-16 11:21:54 -05:00
Lachlan Roberts a0626adad5 javax websocket modules should not transitively export websocket-core
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2020-03-12 16:21:07 +11:00
Lachlan Roberts fef25e7825 Merge branch jetty-10.0.x into jetty-10.0.x-4538-MessageReaderWriter 2020-03-11 14:23:47 +11:00
Lachlan Roberts 34fd1481b8 Issue #4571 - always close MessageSink before completing the Future
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2020-02-20 18:47:04 +11:00
Lachlan Roberts b2eddff228 Issue #4571 - fix broken tests
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2020-02-19 19:38:26 +11:00
Lachlan Roberts 5c839d791d Issue #4538 - allow MessageInputStream not to read to EOF
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2020-02-19 19:31:26 +11:00
Lachlan Roberts e2f86f9a19 Issue #4538 - simplify MessageInputStream and DispatchedMessageSink
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2020-02-19 11:32:03 +11:00
Lachlan 5fe202f29f
Issue #4548 - clean up websocket removing duplicated and unused classes (#4549)
Create new module websocket-util which contains implementation classes shared by websocket-jetty and websocket-javax. Many of these classes had to be changed as the javax and jetty versions of them differed slightly.

Also includes general cleanups, removed unused interfaces and classes, etc..
2020-02-18 21:43:54 +11:00
Lachlan 41a7b8d4e3
Merge pull request #4539 from eclipse/jetty-10.0.x-4501-SharedBlockingCallback
Issue #4501 - remove all SharedBlockingCallback usage from websocket
2020-02-05 10:07:12 +11:00
Lachlan Roberts cbb09413fd Issue #4501 - fix test expectations to throw CloseChannelException
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2020-02-03 18:34:19 +11:00
Lachlan Roberts 182daf8504 Issue #4501 - remove all SharedBlockingCallback usage from websocket
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2020-02-03 17:20:45 +11:00
Lachlan f8219a56cc
Merge pull request #4535 from eclipse/jetty-10.0.x-4462-javaxWSClose
Issue #4462 - do not throw IOException on Javax websocket close
2020-02-03 10:22:23 +11:00
Lachlan Roberts fde1ab3e5b Issue #4462 - fix incorrect test expectations
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2020-01-31 16:31:35 +11:00
Lachlan Roberts bdaa06e8dd Issue #4462 - do not throw IOException on Javax websocket close
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2020-01-31 11:09:30 +11:00
Simone Bordet ce6e146ac1
Merge pull request #4489 from eclipse/jetty-10.0.x-2643-pkcs12_keystores
Fixes #2643 - Switch SslContextFactory.keystoreType from JKS to PKCS12.
2020-01-30 19:28:49 +01:00
Lachlan Roberts 006fd3f913 Issue #4226 - fix test failures
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2020-01-30 11:26:51 +11:00
Lachlan Roberts 82c61c48eb Merge remote-tracking branch 'origin/jetty-10.0.x' into jetty-10.0.x-4226-JavaxWebSocketJPMS 2020-01-30 10:37:34 +11:00
Lachlan 19354d0c24
Merge pull request #4523 from eclipse/jetty-10.0.x-4502-wsOnClose
Issue #4502 - allow changing of close response from jetty and javax websocket onClose events
2020-01-30 09:10:48 +11:00