|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT |
@Retention(value=RUNTIME) @Target(value=TYPE) public @interface ServerEndpoint
This class level annotation declares that the class it decorates is a web socket endpoint that will be deployed and made available in the URI-space of a web socket server. The annotation allows the developer to define the URL (or URI template) which this endpoint will be published, and other important properties of the endpoint to the websocket runtime, such as the encoders it uses to send messages.
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);
}
}
Required Element Summary | |
---|---|
String |
value
The URI or URI-template, level-1 (See RFC 6570) where the endpoint will be deployed. |
Optional Element Summary | |
---|---|
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. |
Class<? extends Decoder>[] |
decoders
The ordered array of decoder classes this endpoint will use. |
Class<? extends Encoder>[] |
encoders
The ordered array of encoder classes this endpoint will use. |
String[] |
subprotocols
The ordered array of web socket protocols this endpoint supports. |
Element Detail |
---|
public abstract String value
@ServerEndpoint("/chat")
@ServerEndpoint("/chat/{user}")
@ServerEndpoint("/booking/{privilege-level}")
public abstract String[] subprotocols
public abstract Class<? extends Decoder>[] decoders
public abstract Class<? extends Encoder>[] encoders
public abstract Class<? extends ServerEndpointConfig.Configurator> configurator
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT |