org.springframework.web.socket.server.standard

## Class ServerEndpointRegistration

- java.lang.Object
- - javax.websocket.server.ServerEndpointConfig.Configurator
  - - org.springframework.web.socket.server.standard.ServerEndpointRegistration

All Implemented Interfaces:
  EndpointConfig, ServerEndpointConfig, org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanFactoryAware

    public class ServerEndpointRegistration
    extends ServerEndpointConfig.Configurator
    implements ServerEndpointConfig, org.springframework.beans.factory.BeanFactoryAware

An implementation of `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.

Since:
  4.0
Author:
  Rossen Stoyanchev, Juergen Hoeller
See Also:
  `ServerEndpointExporter`

### Nested Class Summary

### Nested classes/interfaces inherited from interface javax.websocket.server.ServerEndpointConfig

`ServerEndpointConfig.Builder, ServerEndpointConfig.Configurator`

### Constructor Summary

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

### Method Summary

All Methods Instance Methods Concrete Methods
`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(org.springframework.beans.factory.BeanFactory beanFactory)`
`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()`

### Methods inherited from class javax.websocket.server.ServerEndpointConfig.Configurator

`checkOrigin, getNegotiatedExtensions, getNegotiatedSubprotocol`

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

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

### Constructor Detail

#### ServerEndpointRegistration

    public ServerEndpointRegistration(String path,
                                      Endpoint endpoint)

Create a new `ServerEndpointRegistration` instance from an `javax.websocket.Endpoint` instance.

Parameters:
  `path` - the endpoint path
  `endpoint` - the endpoint instance

#### ServerEndpointRegistration

    public ServerEndpointRegistration(String path,
                                      Class<? extends Endpoint> endpointClass)

Create a new `ServerEndpointRegistration` instance from an `javax.websocket.Endpoint` class.

Parameters:
  `path` - the endpoint path
  `endpointClass` - the endpoint class

### Method Detail

#### getPath

    public String getPath()

Specified by:
  `getPath` in interface `ServerEndpointConfig`

#### getEndpointClass

    public Class<? extends Endpoint> getEndpointClass()

Specified by:
  `getEndpointClass` in interface `ServerEndpointConfig`

#### getEndpoint

    public Endpoint getEndpoint()

#### setSubprotocols

    public void setSubprotocols(List<String> subprotocols)

#### getSubprotocols

    public List<String> getSubprotocols()

Specified by:
  `getSubprotocols` in interface `ServerEndpointConfig`

#### setExtensions

    public void setExtensions(List<Extension> extensions)

#### getExtensions

    public List<Extension> getExtensions()

Specified by:
  `getExtensions` in interface `ServerEndpointConfig`

#### setEncoders

    public void setEncoders(List<Class<? extends Encoder>> encoders)

#### getEncoders

    public List<Class<? extends Encoder>> getEncoders()

Specified by:
  `getEncoders` in interface `EndpointConfig`

#### setDecoders

    public void setDecoders(List<Class<? extends Decoder>> decoders)

#### getDecoders

    public List<Class<? extends Decoder>> getDecoders()

Specified by:
  `getDecoders` in interface `EndpointConfig`

#### setUserProperties

    public void setUserProperties(Map<String,Object> userProperties)

#### getUserProperties

    public Map<String,Object> getUserProperties()

Specified by:
  `getUserProperties` in interface `EndpointConfig`

#### getConfigurator

    public ServerEndpointConfig.Configurator getConfigurator()

Specified by:
  `getConfigurator` in interface `ServerEndpointConfig`

#### getEndpointInstance

    public final <T> T getEndpointInstance(Class<T> clazz)
                                    throws InstantiationException

Overrides:
  `getEndpointInstance` in class `ServerEndpointConfig.Configurator`
Throws:
  `InstantiationException`

#### modifyHandshake

    public void modifyHandshake(ServerEndpointConfig sec,
                                HandshakeRequest request,
                                HandshakeResponse response)

Overrides:
  `modifyHandshake` in class `ServerEndpointConfig.Configurator`

#### setBeanFactory

    public void setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory)

Specified by:
  `setBeanFactory` in interface `org.springframework.beans.factory.BeanFactoryAware`

#### toString

    public String toString()

Overrides:
  `toString` in class `Object`