org.springframework.web.socket.server.standard

## Class ServerEndpointExporter

- java.lang.Object
- - org.springframework.context.support.ApplicationObjectSupport
  - - org.springframework.web.context.support.WebApplicationObjectSupport
    - - org.springframework.web.socket.server.standard.ServerEndpointExporter

All Implemented Interfaces:
  org.springframework.beans.factory.Aware, org.springframework.beans.factory.InitializingBean, org.springframework.beans.factory.SmartInitializingSingleton, org.springframework.context.ApplicationContextAware, org.springframework.web.context.ServletContextAware

    public class ServerEndpointExporter
    extends org.springframework.web.context.support.WebApplicationObjectSupport
    implements org.springframework.beans.factory.InitializingBean, org.springframework.beans.factory.SmartInitializingSingleton

Detects beans of type `ServerEndpointConfig` and registers with the standard Java WebSocket runtime. Also detects beans annotated with `ServerEndpoint` and registers them as well. Although not required, it is likely annotated endpoints should have their `configurator` property set to `SpringConfigurator`.

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 in `web.xml`.

Since:
  4.0
Author:
  Rossen Stoyanchev, Juergen Hoeller
See Also:
  `ServerEndpointRegistration`, `SpringConfigurator`, `ServletServerContainerFactoryBean`

### Field Summary

### Fields inherited from class org.springframework.context.support.ApplicationObjectSupport

`logger`

### Constructor Summary

Constructors
Constructor and Description
`ServerEndpointExporter()`

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `afterPropertiesSet()`
`void` `afterSingletonsInstantiated()`
`protected ServerContainer` `getServerContainer()` Return the JSR-356 `ServerContainer` to use for endpoint registration.
`protected void` `initServletContext(ServletContext servletContext)`
`protected boolean` `isContextRequired()`
`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-356 `ServerContainer` to use for endpoint registration.

### Methods inherited from class org.springframework.web.context.support.WebApplicationObjectSupport

`getServletContext, getTempDir, getWebApplicationContext, initApplicationContext, setServletContext`

### Methods inherited from class org.springframework.context.support.ApplicationObjectSupport

`getApplicationContext, getMessageSourceAccessor, initApplicationContext, obtainApplicationContext, requiredContextClass, setApplicationContext`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### ServerEndpointExporter

    public ServerEndpointExporter()

### Method Detail

#### 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.

Parameters:
  `annotatedEndpointClasses` - `ServerEndpoint`-annotated types

#### setServerContainer

    public void setServerContainer(@Nullable
                                   ServerContainer serverContainer)

Set the JSR-356 `ServerContainer` to use for endpoint registration. If not set, the container is going to be retrieved via the `ServletContext`.

#### getServerContainer

    @Nullable
    protected ServerContainer getServerContainer()

Return the JSR-356 `ServerContainer` to use for endpoint registration.

#### initServletContext

    protected void initServletContext(ServletContext servletContext)

Overrides:
  `initServletContext` in class `org.springframework.web.context.support.WebApplicationObjectSupport`

#### isContextRequired

    protected boolean isContextRequired()

Overrides:
  `isContextRequired` in class `org.springframework.web.context.support.WebApplicationObjectSupport`

#### afterPropertiesSet

    public void afterPropertiesSet()

Specified by:
  `afterPropertiesSet` in interface `org.springframework.beans.factory.InitializingBean`

#### afterSingletonsInstantiated

    public void afterSingletonsInstantiated()

Specified by:
  `afterSingletonsInstantiated` in interface `org.springframework.beans.factory.SmartInitializingSingleton`

#### registerEndpoints

    protected void registerEndpoints()

Actually register the endpoints. Called by `afterSingletonsInstantiated()`.