public abstract class WebSocketServlet extends javax.servlet.http.HttpServlet implements HttpEventServlet
Constructor and Description |
---|
WebSocketServlet() |
Modifier and Type | Method and Description |
---|---|
protected abstract StreamInbound |
createWebSocketInbound(String subProtocol,
javax.servlet.http.HttpServletRequest request)
Create the instance that will process this inbound connection.
|
void |
event(HttpEvent event)
Process the given IO event.
|
protected String |
selectSubProtocol(List<String> subProtocols)
Intended to be overridden by sub-classes that wish to select a
sub-protocol if the client provides a list of supported protocols.
|
protected boolean |
verifyOrigin(String origin)
Intended to be overridden by sub-classes that wish to verify the origin
of a WebSocket request before processing it.
|
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service, service
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, init, log, log
public void event(HttpEvent event) throws IOException, javax.servlet.ServletException
HttpEventServlet
event
in interface HttpEventServlet
event
- The event that will be processedIOException
javax.servlet.ServletException
protected boolean verifyOrigin(String origin)
origin
- The value of the origin header from the request which
may be null
true
to accept the request. false
to
reject it. This default implementation always returns
true
.protected String selectSubProtocol(List<String> subProtocols)
subProtocols
- The list of sub-protocols supported by the client
in client preference order. The server is under no
obligation to respect the declared preferencenull
if no sub-protocol is selected or the name of
the protocol which must be one of the protocols listed by
the client. This default implementation always returns
null
.protected abstract StreamInbound createWebSocketInbound(String subProtocol, javax.servlet.http.HttpServletRequest request)
subProtocol
- The sub-protocol agreed between the client and
server or null
if none was agreedrequest
- The HTTP request that initiated this WebSocket
connection. Note that this object is only
valid inside this method. You must not retain a
reference to it outside the execution of this
method. If Tomcat detects such access, it will throw
an IllegalStateExceptionCopyright © 2014 JBoss by Red Hat. All Rights Reserved.