Fixes #11213 - Improve programming guide WebSocket JPMS documentation
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
This commit is contained in:
parent
0740b6d1b2
commit
4fca6781ce
|
@ -151,7 +151,31 @@ include::{doc_code}/org/eclipse/jetty/docs/programming/WebSocketDocs.java[tags=s
|
|||
===== Annotated Endpoints
|
||||
|
||||
A WebSocket endpoint may annotate methods with `+org.eclipse.jetty.websocket.api.annotations.*+` annotations to receive WebSocket events.
|
||||
Each annotated method may take an optional `Session` argument as its first parameter:
|
||||
|
||||
Jetty uses ``MethodHandle``s to instantiate WebSocket endpoints and invoke WebSocket event methods, so WebSocket endpoint classes and WebSocket event methods must be `public`.
|
||||
|
||||
When using JPMS, you must ensure that the Jetty JPMS module `org.eclipse.jetty.websocket.common` can _read_ (in JPMS terms) the WebSocket endpoint classes in your JPMS module.
|
||||
|
||||
For example, your application may use the Jetty WebSocket client so that the JPMS module that contains your WebSocket endpoint classes looks like this:
|
||||
|
||||
[source,java]
|
||||
.module-info.java
|
||||
----
|
||||
module com.acme.websocket
|
||||
{
|
||||
// The Jetty WebSocket client dependency.
|
||||
requires org.eclipse.jetty.websocket.client;
|
||||
}
|
||||
----
|
||||
|
||||
To ensure that Jetty _reads_ your JPMS module, you must start the JVM with the following option:
|
||||
|
||||
[source]
|
||||
----
|
||||
$ java --add-reads org.eclipse.jetty.websocket.common=com.acme.websocket ...
|
||||
----
|
||||
|
||||
Each annotated event method may take an optional `Session` argument as its first parameter:
|
||||
|
||||
[source,java,indent=0]
|
||||
----
|
||||
|
|
Loading…
Reference in New Issue