@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 | valueThe 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> | configuratorThe optional custom configurator class that the developer would like to use to further configure new instances of
 this endpoint. | 
| Class<? extends Decoder>[] | decodersThe ordered array of decoder classes this endpoint will use. | 
| Class<? extends Encoder>[] | encodersThe ordered array of encoder classes this endpoint will use. | 
| String[] | subprotocolsThe 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 © 2012–2019 Oracle Corporation. All rights reserved.