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:
    javax.websocket.EndpointConfig, javax.websocket.server.ServerEndpointConfig, Aware, BeanFactoryAware


    public class ServerEndpointRegistration
    extends javax.websocket.server.ServerEndpointConfig.Configurator
    implements javax.websocket.server.ServerEndpointConfig, 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

        javax.websocket.server.ServerEndpointConfig.Builder, javax.websocket.server.ServerEndpointConfig.Configurator
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      javax.websocket.server.ServerEndpointConfig.Configurator getConfigurator() 
      java.util.List<java.lang.Class<? extends javax.websocket.Decoder>> getDecoders() 
      java.util.List<java.lang.Class<? extends javax.websocket.Encoder>> getEncoders() 
      javax.websocket.Endpoint getEndpoint() 
      java.lang.Class<? extends javax.websocket.Endpoint> getEndpointClass() 
      <T> T getEndpointInstance(java.lang.Class<T> clazz) 
      java.util.List<javax.websocket.Extension> getExtensions() 
      java.lang.String getPath() 
      java.util.List<java.lang.String> getSubprotocols() 
      java.util.Map<java.lang.String,java.lang.Object> getUserProperties() 
      void modifyHandshake(javax.websocket.server.ServerEndpointConfig sec, javax.websocket.server.HandshakeRequest request, javax.websocket.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 javax.websocket.Decoder>> decoders) 
      void setEncoders(java.util.List<java.lang.Class<? extends javax.websocket.Encoder>> encoders) 
      void setExtensions(java.util.List<javax.websocket.Extension> extensions) 
      void setSubprotocols(java.util.List<java.lang.String> subprotocols) 
      void setUserProperties(java.util.Map<java.lang.String,java.lang.Object> userProperties) 
      java.lang.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(java.lang.String path,
                                          javax.websocket.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(java.lang.String path,
                                          java.lang.Class<? extends javax.websocket.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 java.lang.String getPath()
        Specified by:
        getPath in interface javax.websocket.server.ServerEndpointConfig
      • getEndpointClass

        public java.lang.Class<? extends javax.websocket.Endpoint> getEndpointClass()
        Specified by:
        getEndpointClass in interface javax.websocket.server.ServerEndpointConfig
      • getEndpoint

        public javax.websocket.Endpoint getEndpoint()
      • setSubprotocols

        public void setSubprotocols(java.util.List<java.lang.String> subprotocols)
      • getSubprotocols

        public java.util.List<java.lang.String> getSubprotocols()
        Specified by:
        getSubprotocols in interface javax.websocket.server.ServerEndpointConfig
      • setExtensions

        public void setExtensions(java.util.List<javax.websocket.Extension> extensions)
      • getExtensions

        public java.util.List<javax.websocket.Extension> getExtensions()
        Specified by:
        getExtensions in interface javax.websocket.server.ServerEndpointConfig
      • setEncoders

        public void setEncoders(java.util.List<java.lang.Class<? extends javax.websocket.Encoder>> encoders)
      • getEncoders

        public java.util.List<java.lang.Class<? extends javax.websocket.Encoder>> getEncoders()
        Specified by:
        getEncoders in interface javax.websocket.EndpointConfig
      • setDecoders

        public void setDecoders(java.util.List<java.lang.Class<? extends javax.websocket.Decoder>> decoders)
      • getDecoders

        public java.util.List<java.lang.Class<? extends javax.websocket.Decoder>> getDecoders()
        Specified by:
        getDecoders in interface javax.websocket.EndpointConfig
      • setUserProperties

        public void setUserProperties(java.util.Map<java.lang.String,java.lang.Object> userProperties)
      • getUserProperties

        public java.util.Map<java.lang.String,java.lang.Object> getUserProperties()
        Specified by:
        getUserProperties in interface javax.websocket.EndpointConfig
      • getConfigurator

        public javax.websocket.server.ServerEndpointConfig.Configurator getConfigurator()
        Specified by:
        getConfigurator in interface javax.websocket.server.ServerEndpointConfig
      • getEndpointInstance

        public final <T> T getEndpointInstance(java.lang.Class<T> clazz)
                                        throws java.lang.InstantiationException
        Overrides:
        getEndpointInstance in class javax.websocket.server.ServerEndpointConfig.Configurator
        Throws:
        java.lang.InstantiationException
      • modifyHandshake

        public void modifyHandshake(javax.websocket.server.ServerEndpointConfig sec,
                                    javax.websocket.server.HandshakeRequest request,
                                    javax.websocket.HandshakeResponse response)
        Overrides:
        modifyHandshake in class javax.websocket.server.ServerEndpointConfig.Configurator
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object