类 ServerEndpointExporter
- java.lang.Object
- org.springframework.context.support.ApplicationObjectSupport
- org.springframework.web.context.support.WebApplicationObjectSupport
- org.springframework.web.socket.server.standard.ServerEndpointExporter
- 所有已实现的接口:
Aware
,InitializingBean
,SmartInitializingSingleton
,ApplicationContextAware
,ServletContextAware
public class ServerEndpointExporter extends WebApplicationObjectSupport implements InitializingBean, SmartInitializingSingleton
Detects beans of typeServerEndpointConfig
and registers with the standard Java WebSocket runtime. Also detects beans annotated withServerEndpoint
and registers them as well. Although not required, it is likely annotated endpoints should have theirconfigurator
property set toSpringConfigurator
.When this class is used, by declaring it in Spring configuration, it should be possible to turn off a Servlet container's scan for WebSocket endpoints. This can be done with the help of the
<absolute-ordering>
element inweb.xml
.- 从以下版本开始:
- 4.0
- 作者:
- Rossen Stoyanchev, Juergen Hoeller
- 另请参阅:
ServerEndpointRegistration
,SpringConfigurator
,ServletServerContainerFactoryBean
字段概要
从类继承的字段 org.springframework.context.support.ApplicationObjectSupport
logger
构造器概要
构造器 构造器 说明 ServerEndpointExporter()
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 void
afterPropertiesSet()
Invoked by the containingBeanFactory
after it has set all bean properties and satisfiedBeanFactoryAware
,ApplicationContextAware
etc.void
afterSingletonsInstantiated()
Invoked right at the end of the singleton pre-instantiation phase, with a guarantee that all regular singleton beans have been created already.protected ServerContainer
getServerContainer()
Return the JSR-356ServerContainer
to use for endpoint registration.protected void
initServletContext(ServletContext servletContext)
Subclasses may override this for custom initialization based on the ServletContext that this application object runs in.protected boolean
isContextRequired()
Overrides the base class behavior to enforce running in an ApplicationContext.protected void
registerEndpoints()
Actually register the endpoints.void
setAnnotatedEndpointClasses(Class<?>... annotatedEndpointClasses)
Explicitly list annotated endpoint types that should be registered on startup.void
setServerContainer(ServerContainer serverContainer)
Set the JSR-356ServerContainer
to use for endpoint registration.从类继承的方法 org.springframework.web.context.support.WebApplicationObjectSupport
getServletContext, getTempDir, getWebApplicationContext, initApplicationContext, setServletContext
从类继承的方法 org.springframework.context.support.ApplicationObjectSupport
getApplicationContext, getMessageSourceAccessor, initApplicationContext, obtainApplicationContext, requiredContextClass, setApplicationContext
构造器详细资料
ServerEndpointExporter
public ServerEndpointExporter()
方法详细资料
setAnnotatedEndpointClasses
public void setAnnotatedEndpointClasses(Class<?>... annotatedEndpointClasses)
Explicitly list annotated endpoint types that should be registered on startup. This can be done if you wish to turn off a Servlet container's scan for endpoints, which goes through all 3rd party jars in the, and rely on Spring configuration instead.- 参数:
annotatedEndpointClasses
-ServerEndpoint
-annotated types
setServerContainer
public void setServerContainer(@Nullable ServerContainer serverContainer)
Set the JSR-356ServerContainer
to use for endpoint registration. If not set, the container is going to be retrieved via theServletContext
.
getServerContainer
@Nullable protected ServerContainer getServerContainer()
Return the JSR-356ServerContainer
to use for endpoint registration.
initServletContext
protected void initServletContext(ServletContext servletContext)
从类复制的说明:WebApplicationObjectSupport
Subclasses may override this for custom initialization based on the ServletContext that this application object runs in.The default implementation is empty. Called by
WebApplicationObjectSupport.initApplicationContext(org.springframework.context.ApplicationContext)
as well asWebApplicationObjectSupport.setServletContext(javax.servlet.ServletContext)
.- 覆盖:
initServletContext
在类中WebApplicationObjectSupport
- 参数:
servletContext
- the ServletContext that this application object runs in (nevernull
)
isContextRequired
protected boolean isContextRequired()
从类复制的说明:WebApplicationObjectSupport
Overrides the base class behavior to enforce running in an ApplicationContext. All accessors will throw IllegalStateException if not running in a context.- 覆盖:
isContextRequired
在类中WebApplicationObjectSupport
- 另请参阅:
ApplicationObjectSupport.getApplicationContext()
,ApplicationObjectSupport.getMessageSourceAccessor()
,WebApplicationObjectSupport.getWebApplicationContext()
,WebApplicationObjectSupport.getServletContext()
,WebApplicationObjectSupport.getTempDir()
afterPropertiesSet
public void afterPropertiesSet()
从接口复制的说明:InitializingBean
Invoked by the containingBeanFactory
after it has set all bean properties and satisfiedBeanFactoryAware
,ApplicationContextAware
etc.This method allows the bean instance to perform validation of its overall configuration and final initialization when all bean properties have been set.
- 指定者:
afterPropertiesSet
在接口中InitializingBean
afterSingletonsInstantiated
public void afterSingletonsInstantiated()
从接口复制的说明:SmartInitializingSingleton
Invoked right at the end of the singleton pre-instantiation phase, with a guarantee that all regular singleton beans have been created already.ListableBeanFactory.getBeansOfType(java.lang.Class<T>)
calls within this method won't trigger accidental side effects during bootstrap.NOTE: This callback won't be triggered for singleton beans lazily initialized on demand after
BeanFactory
bootstrap, and not for any other bean scope either. Carefully use it for beans with the intended bootstrap semantics only.
registerEndpoints
protected void registerEndpoints()
Actually register the endpoints. Called byafterSingletonsInstantiated()
.