public class ServerEndpointRegistration extends ServerEndpointConfig.Configurator implements BeanFactoryAware
javax.websocket.server.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 javax.websocket.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
javax.websocket.server.ServerEndpointConfig.Configurator
to make it easier to
override methods for customizing the handshake process.
ServerEndpointExporter
Modifier and Type | Field and Description |
---|---|
private java.util.List<java.lang.Class<? extends Decoder>> |
decoders |
private java.util.List<java.lang.Class<? extends Encoder>> |
encoders |
private Endpoint |
endpoint |
private BeanCreatingHandlerProvider<Endpoint> |
endpointProvider |
private java.util.List<Extension> |
extensions |
private java.lang.String |
path |
private java.util.List<java.lang.String> |
protocols |
private java.util.Map<java.lang.String,java.lang.Object> |
userProperties |
Constructor and Description |
---|
ServerEndpointRegistration(java.lang.String path,
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) |
Configurator |
getConfigurator() |
java.util.List<java.lang.Class<? extends Decoder>> |
getDecoders() |
java.util.List<java.lang.Class<? extends Encoder>> |
getEncoders() |
Endpoint |
getEndpoint() |
java.lang.Class<? extends Endpoint> |
getEndpointClass() |
<T> T |
getEndpointInstance(java.lang.Class<T> clazz) |
java.util.List<Extension> |
getExtensions() |
java.util.List<Extension> |
getNegotiatedExtensions(java.util.List<Extension> installed,
java.util.List<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(ServerEndpointConfig sec,
HandshakeRequest request,
HandshakeResponse response) |
void |
setBeanFactory(BeanFactory beanFactory)
Callback that supplies the owning factory to a bean instance.
|
void |
setDecoders(java.util.List<java.lang.Class<? extends Decoder>> decoders) |
void |
setEncoders(java.util.List<java.lang.Class<? extends Encoder>> encoders) |
void |
setExtensions(java.util.List<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() |
private final java.lang.String path
@Nullable private final Endpoint endpoint
@Nullable private final BeanCreatingHandlerProvider<Endpoint> endpointProvider
private java.util.List<java.lang.Class<? extends Encoder>> encoders
private java.util.List<java.lang.Class<? extends Decoder>> decoders
private java.util.List<java.lang.String> protocols
private java.util.List<Extension> extensions
private final java.util.Map<java.lang.String,java.lang.Object> userProperties
public ServerEndpointRegistration(java.lang.String path, Endpoint endpoint)
ServerEndpointRegistration
instance from an
javax.websocket.Endpoint
instance.path
- the endpoint pathendpoint
- the endpoint instancepublic java.lang.String getPath()
public java.lang.Class<? extends Endpoint> getEndpointClass()
public Endpoint getEndpoint()
public void setSubprotocols(java.util.List<java.lang.String> protocols)
public java.util.List<java.lang.String> getSubprotocols()
public void setExtensions(java.util.List<Extension> extensions)
public java.util.List<Extension> getExtensions()
public void setUserProperties(java.util.Map<java.lang.String,java.lang.Object> userProperties)
public java.util.Map<java.lang.String,java.lang.Object> getUserProperties()
public void setEncoders(java.util.List<java.lang.Class<? extends Encoder>> encoders)
public java.util.List<java.lang.Class<? extends Encoder>> getEncoders()
public void setDecoders(java.util.List<java.lang.Class<? extends Decoder>> decoders)
public java.util.List<java.lang.Class<? extends Decoder>> getDecoders()
public Configurator getConfigurator()
public void setBeanFactory(BeanFactory beanFactory)
BeanFactoryAware
Invoked after the population of normal bean properties
but before an initialization callback such as
InitializingBean.afterPropertiesSet()
or a custom init-method.
setBeanFactory
in interface BeanFactoryAware
beanFactory
- owning BeanFactory (never null
).
The bean can immediately call methods on the factory.BeanInitializationException
public final <T> T getEndpointInstance(java.lang.Class<T> clazz) throws java.lang.InstantiationException
java.lang.InstantiationException
public void modifyHandshake(ServerEndpointConfig sec, HandshakeRequest request, HandshakeResponse response)
public boolean checkOrigin(java.lang.String originHeaderValue)
public java.lang.String getNegotiatedSubprotocol(java.util.List<java.lang.String> supported, java.util.List<java.lang.String> requested)
public java.util.List<Extension> getNegotiatedExtensions(java.util.List<Extension> installed, java.util.List<Extension> requested)
public java.lang.String toString()