public class ServerEndpointRegistration
extends javax.websocket.server.ServerEndpointConfig.Configurator
implements javax.websocket.server.ServerEndpointConfig, org.springframework.beans.factory.BeanFactoryAware
ServerEndpointConfig for use in
Spring applications. A ServerEndpointRegistration bean is detected by
ServerEndpointExporter and registered with a Java WebSocket runtime at startup.
Class constructors accept a singleton Endpoint instance
or an Endpoint specified by type Class. When specified by type, the endpoint
will be instantiated and initialized through the Spring ApplicationContext before
each client WebSocket connection.
This class also extends
ServerEndpointConfig.Configurator to make it easier to
override methods for customizing the handshake process.
ServerEndpointExporter| Constructor and Description |
|---|
ServerEndpointRegistration(java.lang.String path,
java.lang.Class<? extends javax.websocket.Endpoint> endpointClass)
Create a new
ServerEndpointRegistration instance from an
javax.websocket.Endpoint class. |
ServerEndpointRegistration(java.lang.String path,
javax.websocket.Endpoint endpoint)
Create a new
ServerEndpointRegistration instance from an
javax.websocket.Endpoint instance. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
checkOrigin(java.lang.String originHeaderValue) |
javax.websocket.server.ServerEndpointConfig.Configurator |
getConfigurator() |
java.util.List<java.lang.Class<? extends javax.websocket.Decoder>> |
getDecoders() |
java.util.List<java.lang.Class<? extends javax.websocket.Encoder>> |
getEncoders() |
javax.websocket.Endpoint |
getEndpoint() |
java.lang.Class<? extends javax.websocket.Endpoint> |
getEndpointClass() |
<T> T |
getEndpointInstance(java.lang.Class<T> clazz) |
java.util.List<javax.websocket.Extension> |
getExtensions() |
java.util.List<javax.websocket.Extension> |
getNegotiatedExtensions(java.util.List<javax.websocket.Extension> installed,
java.util.List<javax.websocket.Extension> requested) |
java.lang.String |
getNegotiatedSubprotocol(java.util.List<java.lang.String> supported,
java.util.List<java.lang.String> requested) |
java.lang.String |
getPath() |
java.util.List<java.lang.String> |
getSubprotocols() |
java.util.Map<java.lang.String,java.lang.Object> |
getUserProperties() |
void |
modifyHandshake(javax.websocket.server.ServerEndpointConfig sec,
javax.websocket.server.HandshakeRequest request,
javax.websocket.HandshakeResponse response) |
void |
setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory) |
void |
setDecoders(java.util.List<java.lang.Class<? extends javax.websocket.Decoder>> decoders) |
void |
setEncoders(java.util.List<java.lang.Class<? extends javax.websocket.Encoder>> encoders) |
void |
setExtensions(java.util.List<javax.websocket.Extension> extensions) |
void |
setSubprotocols(java.util.List<java.lang.String> protocols) |
void |
setUserProperties(java.util.Map<java.lang.String,java.lang.Object> userProperties) |
java.lang.String |
toString() |
public ServerEndpointRegistration(java.lang.String path,
java.lang.Class<? extends javax.websocket.Endpoint> endpointClass)
ServerEndpointRegistration instance from an
javax.websocket.Endpoint class.path - the endpoint pathendpointClass - the endpoint classpublic ServerEndpointRegistration(java.lang.String path,
javax.websocket.Endpoint endpoint)
ServerEndpointRegistration instance from an
javax.websocket.Endpoint instance.path - the endpoint pathendpoint - the endpoint instancepublic java.lang.String getPath()
getPath in interface javax.websocket.server.ServerEndpointConfigpublic java.lang.Class<? extends javax.websocket.Endpoint> getEndpointClass()
getEndpointClass in interface javax.websocket.server.ServerEndpointConfigpublic javax.websocket.Endpoint getEndpoint()
public void setSubprotocols(java.util.List<java.lang.String> protocols)
public java.util.List<java.lang.String> getSubprotocols()
getSubprotocols in interface javax.websocket.server.ServerEndpointConfigpublic void setExtensions(java.util.List<javax.websocket.Extension> extensions)
public java.util.List<javax.websocket.Extension> getExtensions()
getExtensions in interface javax.websocket.server.ServerEndpointConfigpublic void setUserProperties(java.util.Map<java.lang.String,java.lang.Object> userProperties)
public java.util.Map<java.lang.String,java.lang.Object> getUserProperties()
getUserProperties in interface javax.websocket.EndpointConfigpublic void setEncoders(java.util.List<java.lang.Class<? extends javax.websocket.Encoder>> encoders)
public java.util.List<java.lang.Class<? extends javax.websocket.Encoder>> getEncoders()
getEncoders in interface javax.websocket.EndpointConfigpublic void setDecoders(java.util.List<java.lang.Class<? extends javax.websocket.Decoder>> decoders)
public java.util.List<java.lang.Class<? extends javax.websocket.Decoder>> getDecoders()
getDecoders in interface javax.websocket.EndpointConfigpublic javax.websocket.server.ServerEndpointConfig.Configurator getConfigurator()
getConfigurator in interface javax.websocket.server.ServerEndpointConfigpublic void setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory)
setBeanFactory in interface org.springframework.beans.factory.BeanFactoryAwarepublic final <T> T getEndpointInstance(java.lang.Class<T> clazz)
throws java.lang.InstantiationException
getEndpointInstance in class javax.websocket.server.ServerEndpointConfig.Configuratorjava.lang.InstantiationExceptionpublic void modifyHandshake(javax.websocket.server.ServerEndpointConfig sec,
javax.websocket.server.HandshakeRequest request,
javax.websocket.HandshakeResponse response)
modifyHandshake in class javax.websocket.server.ServerEndpointConfig.Configuratorpublic boolean checkOrigin(java.lang.String originHeaderValue)
checkOrigin in class javax.websocket.server.ServerEndpointConfig.Configuratorpublic java.lang.String getNegotiatedSubprotocol(java.util.List<java.lang.String> supported,
java.util.List<java.lang.String> requested)
getNegotiatedSubprotocol in class javax.websocket.server.ServerEndpointConfig.Configuratorpublic java.util.List<javax.websocket.Extension> getNegotiatedExtensions(java.util.List<javax.websocket.Extension> installed,
java.util.List<javax.websocket.Extension> requested)
getNegotiatedExtensions in class javax.websocket.server.ServerEndpointConfig.Configuratorpublic java.lang.String toString()
toString in class java.lang.Object