public class ServerEndpointRegistration extends ServerEndpointConfig.Configurator implements ServerEndpointConfig, BeanFactoryAware
ServerEndpointConfig for use in
Spring-based 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.
ServerEndpointExporterServerEndpointConfig.Builder, ServerEndpointConfig.Configurator| Constructor and Description |
|---|
ServerEndpointRegistration(String path,
Class<? extends Endpoint> endpointClass)
Create a new
ServerEndpointRegistration instance from an
javax.websocket.Endpoint class. |
ServerEndpointRegistration(String path,
Endpoint endpoint)
Create a new
ServerEndpointRegistration instance from an
javax.websocket.Endpoint instance. |
| Modifier and Type | Method and Description |
|---|---|
ServerEndpointConfig.Configurator |
getConfigurator() |
List<Class<? extends Decoder>> |
getDecoders() |
List<Class<? extends Encoder>> |
getEncoders() |
Endpoint |
getEndpoint() |
Class<? extends Endpoint> |
getEndpointClass() |
<T> T |
getEndpointInstance(Class<T> clazz) |
List<Extension> |
getExtensions() |
String |
getPath() |
List<String> |
getSubprotocols() |
Map<String,Object> |
getUserProperties() |
void |
modifyHandshake(ServerEndpointConfig sec,
HandshakeRequest request,
HandshakeResponse response) |
void |
setBeanFactory(BeanFactory beanFactory)
Callback that supplies the owning factory to a bean instance.
|
void |
setDecoders(List<Class<? extends Decoder>> decoders) |
void |
setEncoders(List<Class<? extends Encoder>> encoders) |
void |
setExtensions(List<Extension> extensions) |
void |
setSubprotocols(List<String> subprotocols) |
void |
setUserProperties(Map<String,Object> userProperties) |
String |
toString() |
checkOrigin, getNegotiatedExtensions, getNegotiatedSubprotocolpublic ServerEndpointRegistration(String path, Endpoint endpoint)
ServerEndpointRegistration instance from an
javax.websocket.Endpoint instance.path - the endpoint pathendpoint - the endpoint instancepublic ServerEndpointRegistration(String path, Class<? extends Endpoint> endpointClass)
ServerEndpointRegistration instance from an
javax.websocket.Endpoint class.path - the endpoint pathendpointClass - the endpoint classpublic String getPath()
getPath in interface ServerEndpointConfigpublic Class<? extends Endpoint> getEndpointClass()
getEndpointClass in interface ServerEndpointConfigpublic Endpoint getEndpoint()
public List<String> getSubprotocols()
getSubprotocols in interface ServerEndpointConfigpublic List<Extension> getExtensions()
getExtensions in interface ServerEndpointConfigpublic List<Class<? extends Encoder>> getEncoders()
getEncoders in interface EndpointConfigpublic List<Class<? extends Decoder>> getDecoders()
getDecoders in interface EndpointConfigpublic Map<String,Object> getUserProperties()
getUserProperties in interface EndpointConfigpublic ServerEndpointConfig.Configurator getConfigurator()
getConfigurator in interface ServerEndpointConfigpublic final <T> T getEndpointInstance(Class<T> clazz) throws InstantiationException
getEndpointInstance in class ServerEndpointConfig.ConfiguratorInstantiationExceptionpublic void modifyHandshake(ServerEndpointConfig sec, HandshakeRequest request, HandshakeResponse response)
modifyHandshake in class ServerEndpointConfig.Configuratorpublic void setBeanFactory(BeanFactory beanFactory)
BeanFactoryAwareInvoked after the population of normal bean properties
but before an initialization callback such as
InitializingBean.afterPropertiesSet() or a custom init-method.
setBeanFactory in interface BeanFactoryAwarebeanFactory - owning BeanFactory (never null).
The bean can immediately call methods on the factory.BeanInitializationException