public abstract class WebSocketServlet extends javax.servlet.http.HttpServlet implements WebSocketFactory.Acceptor
The request must have the correct upgrade headers, else it is handled as a normal servlet request.
The initParameter "bufferSize" can be used to set the buffer size, which is also the max frame byte size (default 8192).
The initParameter "maxIdleTime" can be used to set the time in ms that a websocket may be idle before closing.
The initParameter "maxTextMessagesSize" can be used to set the size in characters that a websocket may be accept before closing.
The initParameter "maxBinaryMessagesSize" can be used to set the size in bytes that a websocket may be accept before closing.
The initParameter "minVersion" can be used to set the minimum protocol version accepted. Default is the RFC6455 version (13)
Constructor and Description |
---|
WebSocketServlet() |
Modifier and Type | Method and Description |
---|---|
boolean |
checkOrigin(javax.servlet.http.HttpServletRequest request,
String origin)
Checks the origin of an incoming WebSocket handshake request.
|
void |
destroy() |
void |
init() |
protected void |
service(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response) |
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service
getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
doWebSocketConnect
public void init() throws javax.servlet.ServletException
init
in class javax.servlet.GenericServlet
javax.servlet.ServletException
GenericServlet.init()
protected void service(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException, IOException
service
in class javax.servlet.http.HttpServlet
javax.servlet.ServletException
IOException
HttpServlet.service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
public boolean checkOrigin(javax.servlet.http.HttpServletRequest request, String origin)
WebSocketFactory.Acceptor
Checks the origin of an incoming WebSocket handshake request.
checkOrigin
in interface WebSocketFactory.Acceptor
request
- the incoming HTTP upgrade requestorigin
- the origin URIpublic void destroy()
destroy
in interface javax.servlet.Servlet
destroy
in class javax.servlet.GenericServlet
Copyright © 1995-2013 Mort Bay Consulting. All Rights Reserved.