Class CommonWebSocketServlet

java.lang.Object
javax.servlet.GenericServlet
javax.servlet.http.HttpServlet
org.eclipse.jetty.websocket.servlet.WebSocketServlet
org.openhab.core.io.websocket.CommonWebSocketServlet
All Implemented Interfaces:
Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

@NonNullByDefault public class CommonWebSocketServlet extends org.eclipse.jetty.websocket.servlet.WebSocketServlet
The CommonWebSocketServlet provides the servlet for WebSocket connections.

Clients can authorize in two ways:

  • By setting org.openhab.ws.accessToken.base64. + base64-encoded access token and the WEBSOCKET_PROTOCOL_DEFAULT in the Sec-WebSocket-Protocol header.
  • By providing the access token as query parameter accessToken.
Author:
Jan N. Klug - Initial contribution, Miguel Álvarez Díez - Refactor into a common servlet, Florian Hotze - Support passing access token through Sec-WebSocket-Protocol header
See Also:
  • Field Details

  • Constructor Details

    • CommonWebSocketServlet

      public CommonWebSocketServlet(AuthFilter authFilter) throws javax.servlet.ServletException, org.osgi.service.http.NamespaceException
      Throws:
      javax.servlet.ServletException
      org.osgi.service.http.NamespaceException
  • Method Details

    • configure

      public void configure(@NonNullByDefault({}) org.eclipse.jetty.websocket.servlet.WebSocketServletFactory webSocketServletFactory)
      Specified by:
      configure in class org.eclipse.jetty.websocket.servlet.WebSocketServlet
    • addWebSocketAdapter

      protected void addWebSocketAdapter(WebSocketAdapter wsAdapter)
    • removeWebSocketAdapter

      protected void removeWebSocketAdapter(WebSocketAdapter wsAdapter)