Package org.openhab.core.io.websocket
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 theWEBSOCKET_PROTOCOL_DEFAULT
in theSec-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 Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
addWebSocketAdapter
(WebSocketAdapter wsAdapter) void
configure
(org.eclipse.jetty.websocket.servlet.WebSocketServletFactory webSocketServletFactory) protected void
removeWebSocketAdapter
(WebSocketAdapter wsAdapter) Methods inherited from class org.eclipse.jetty.websocket.servlet.WebSocketServlet
destroy, init, service
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service
Methods inherited from class javax.servlet.GenericServlet
getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
-
Field Details
-
SEC_WEBSOCKET_PROTOCOL_HEADER
- See Also:
-
WEBSOCKET_PROTOCOL_DEFAULT
- See Also:
-
SERVLET_PATH
- See Also:
-
DEFAULT_ADAPTER_ID
- See Also:
-
-
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 classorg.eclipse.jetty.websocket.servlet.WebSocketServlet
-
addWebSocketAdapter
-
removeWebSocketAdapter
-