@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 |
---|---|
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 |
---|---|
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.
|
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
Copyright © 1996-2013, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.