类 ServerEndpointRegistration
- java.lang.Object
- javax.websocket.server.ServerEndpointConfig.Configurator
- org.springframework.web.socket.server.standard.ServerEndpointRegistration
- 所有已实现的接口:
EndpointConfig
,ServerEndpointConfig
,Aware
,BeanFactoryAware
public class ServerEndpointRegistration extends ServerEndpointConfig.Configurator implements ServerEndpointConfig, BeanFactoryAware
An implementation ofServerEndpointConfig
for use in Spring-based applications. AServerEndpointRegistration
bean is detected byServerEndpointExporter
and registered with a Java WebSocket runtime at startup.Class constructors accept a singleton
Endpoint
instance or an Endpoint specified by typeClass
. 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.- 从以下版本开始:
- 4.0
- 作者:
- Rossen Stoyanchev, Juergen Hoeller
- 另请参阅:
ServerEndpointExporter
嵌套类概要
从接口继承的嵌套类/接口 javax.websocket.server.ServerEndpointConfig
ServerEndpointConfig.Builder, ServerEndpointConfig.Configurator
构造器概要
构造器 构造器 说明 ServerEndpointRegistration(String path, Class<? extends Endpoint> endpointClass)
Create a newServerEndpointRegistration
instance from anjavax.websocket.Endpoint
class.ServerEndpointRegistration(String path, Endpoint endpoint)
Create a newServerEndpointRegistration
instance from anjavax.websocket.Endpoint
instance.
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 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()
从类继承的方法 javax.websocket.server.ServerEndpointConfig.Configurator
checkOrigin, getNegotiatedExtensions, getNegotiatedSubprotocol
构造器详细资料
ServerEndpointRegistration
public ServerEndpointRegistration(String path, Endpoint endpoint)
Create a newServerEndpointRegistration
instance from anjavax.websocket.Endpoint
instance.- 参数:
path
- the endpoint pathendpoint
- the endpoint instance
ServerEndpointRegistration
public ServerEndpointRegistration(String path, Class<? extends Endpoint> endpointClass)
Create a newServerEndpointRegistration
instance from anjavax.websocket.Endpoint
class.- 参数:
path
- the endpoint pathendpointClass
- the endpoint class
方法详细资料
getPath
public String getPath()
- 指定者:
getPath
在接口中ServerEndpointConfig
getEndpointClass
public Class<? extends Endpoint> getEndpointClass()
- 指定者:
getEndpointClass
在接口中ServerEndpointConfig
getEndpoint
public Endpoint getEndpoint()
setSubprotocols
public void setSubprotocols(List<String> subprotocols)
getSubprotocols
public List<String> getSubprotocols()
- 指定者:
getSubprotocols
在接口中ServerEndpointConfig
setExtensions
public void setExtensions(List<Extension> extensions)
getExtensions
public List<Extension> getExtensions()
- 指定者:
getExtensions
在接口中ServerEndpointConfig
setEncoders
public void setEncoders(List<Class<? extends Encoder>> encoders)
getEncoders
public List<Class<? extends Encoder>> getEncoders()
- 指定者:
getEncoders
在接口中EndpointConfig
setDecoders
public void setDecoders(List<Class<? extends Decoder>> decoders)
getDecoders
public List<Class<? extends Decoder>> getDecoders()
- 指定者:
getDecoders
在接口中EndpointConfig
setUserProperties
public void setUserProperties(Map<String,Object> userProperties)
getUserProperties
public Map<String,Object> getUserProperties()
- 指定者:
getUserProperties
在接口中EndpointConfig
getConfigurator
public ServerEndpointConfig.Configurator getConfigurator()
- 指定者:
getConfigurator
在接口中ServerEndpointConfig
getEndpointInstance
public final <T> T getEndpointInstance(Class<T> clazz) throws InstantiationException
modifyHandshake
public void modifyHandshake(ServerEndpointConfig sec, HandshakeRequest request, HandshakeResponse response)
setBeanFactory
public void setBeanFactory(BeanFactory beanFactory)
从接口复制的说明:BeanFactoryAware
Callback that supplies the owning factory to a bean instance.Invoked after the population of normal bean properties but before an initialization callback such as
InitializingBean.afterPropertiesSet()
or a custom init-method.- 指定者:
setBeanFactory
在接口中BeanFactoryAware
- 参数:
beanFactory
- owning BeanFactory (nevernull
). The bean can immediately call methods on the factory.- 另请参阅:
BeanInitializationException