@Retention(value=RUNTIME)
@Target(value=TYPE)
public @interface ServerEndpoint
The annotated class must have a public no-arg constructor.
For example:
@ServerEndpoint("/hello");
public class HelloServer {
@OnMessage
public void processGreeting(String message, Session session) {
System.out.println("Greeting received:" + message);
}
}
Modifier and Type | Required Element and Description |
---|---|
java.lang.String |
value
The URI or URI-template, level-1 (See RFC 6570) where the
endpoint will be deployed.
|
Modifier and Type | Optional Element and Description |
---|---|
java.lang.Class<? extends ServerEndpointConfig.Configurator> |
configurator
The optional custom configurator class that the developer would like to use to further configure new instances of
this endpoint.
|
java.lang.Class<? extends Decoder>[] |
decoders
The ordered array of decoder classes this endpoint will use.
|
java.lang.Class<? extends Encoder>[] |
encoders
The ordered array of encoder classes this endpoint will use.
|
java.lang.String[] |
subprotocols
The ordered array of web socket protocols this endpoint supports.
|
public abstract java.lang.String value
@ServerEndpoint("/chat")
@ServerEndpoint("/chat/{user}")
@ServerEndpoint("/booking/{privilege-level}")
public abstract java.lang.String[] subprotocols
public abstract java.lang.Class<? extends Decoder>[] decoders
public abstract java.lang.Class<? extends Encoder>[] encoders
public abstract java.lang.Class<? extends ServerEndpointConfig.Configurator> configurator