Errai 3.0.1-SNAPSHOT

org.jboss.as.websockets.servlet
Class WebSocketServlet

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by org.jboss.as.websockets.servlet.WebSocketServlet
All Implemented Interfaces:
Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig, org.jboss.servlet.http.HttpEventServlet
Direct Known Subclasses:
JBossAS7WebSocketServlet

public abstract class WebSocketServlet
extends javax.servlet.http.HttpServlet
implements org.jboss.servlet.http.HttpEventServlet

A very, very early and experimental spike to get websockets working in JBoss AS. Designed for JBoss AS 7.1.2 and later.

Author:
Mike Brock
See Also:
Serialized Form

Constructor Summary
protected WebSocketServlet()
           
protected WebSocketServlet(String protocolName)
          Set the protocol name to be returned in the Sec-WebSocket-Protocol header attribute during negotiation.
 
Method Summary
protected  void doDelete(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)
           
protected  void doGet(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)
           
protected  void doHead(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)
           
protected  void doOptions(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)
           
protected  void doPost(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)
           
protected  void doPut(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)
           
protected  void doTrace(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)
           
 void event(org.jboss.servlet.http.HttpEvent event)
          Handle an event from the web container.
protected  long getLastModified(javax.servlet.http.HttpServletRequest req)
           
protected  void onReceivedFrame(WebSocket socket)
          Called when a new text frame is received.
protected  void onSocketClosed(WebSocket socket)
          Called when the websocket is closed.
protected  void onSocketOpened(WebSocket socket)
          Called when a new websocket is opened.
protected  void service(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)
           
 void service(javax.servlet.ServletRequest req, javax.servlet.ServletResponse res)
           
 
Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.servlet.Servlet
destroy, getServletConfig, getServletInfo, init
 

Constructor Detail

WebSocketServlet

protected WebSocketServlet(String protocolName)
Set the protocol name to be returned in the Sec-WebSocket-Protocol header attribute during negotiation.

Parameters:
protocolName - the protocol string to be advertised in the Sec-WebSocket-Protocol header when clients negotiate a new websocket.

WebSocketServlet

protected WebSocketServlet()
Method Detail

event

public final void event(org.jboss.servlet.http.HttpEvent event)
                 throws IOException,
                        javax.servlet.ServletException
Handle an event from the web container.

Specified by:
event in interface org.jboss.servlet.http.HttpEventServlet
Parameters:
event -
Throws:
IOException
javax.servlet.ServletException

doGet

protected final void doGet(javax.servlet.http.HttpServletRequest req,
                           javax.servlet.http.HttpServletResponse resp)
                    throws javax.servlet.ServletException,
                           IOException
Overrides:
doGet in class javax.servlet.http.HttpServlet
Throws:
javax.servlet.ServletException
IOException

getLastModified

protected final long getLastModified(javax.servlet.http.HttpServletRequest req)
Overrides:
getLastModified in class javax.servlet.http.HttpServlet

doHead

protected final void doHead(javax.servlet.http.HttpServletRequest req,
                            javax.servlet.http.HttpServletResponse resp)
                     throws javax.servlet.ServletException,
                            IOException
Overrides:
doHead in class javax.servlet.http.HttpServlet
Throws:
javax.servlet.ServletException
IOException

doPost

protected final void doPost(javax.servlet.http.HttpServletRequest req,
                            javax.servlet.http.HttpServletResponse resp)
                     throws javax.servlet.ServletException,
                            IOException
Overrides:
doPost in class javax.servlet.http.HttpServlet
Throws:
javax.servlet.ServletException
IOException

doPut

protected final void doPut(javax.servlet.http.HttpServletRequest req,
                           javax.servlet.http.HttpServletResponse resp)
                    throws javax.servlet.ServletException,
                           IOException
Overrides:
doPut in class javax.servlet.http.HttpServlet
Throws:
javax.servlet.ServletException
IOException

doDelete

protected final void doDelete(javax.servlet.http.HttpServletRequest req,
                              javax.servlet.http.HttpServletResponse resp)
                       throws javax.servlet.ServletException,
                              IOException
Overrides:
doDelete in class javax.servlet.http.HttpServlet
Throws:
javax.servlet.ServletException
IOException

doOptions

protected final void doOptions(javax.servlet.http.HttpServletRequest req,
                               javax.servlet.http.HttpServletResponse resp)
                        throws javax.servlet.ServletException,
                               IOException
Overrides:
doOptions in class javax.servlet.http.HttpServlet
Throws:
javax.servlet.ServletException
IOException

doTrace

protected final void doTrace(javax.servlet.http.HttpServletRequest req,
                             javax.servlet.http.HttpServletResponse resp)
                      throws javax.servlet.ServletException,
                             IOException
Overrides:
doTrace in class javax.servlet.http.HttpServlet
Throws:
javax.servlet.ServletException
IOException

service

protected final void service(javax.servlet.http.HttpServletRequest req,
                             javax.servlet.http.HttpServletResponse resp)
                      throws javax.servlet.ServletException,
                             IOException
Overrides:
service in class javax.servlet.http.HttpServlet
Throws:
javax.servlet.ServletException
IOException

service

public final void service(javax.servlet.ServletRequest req,
                          javax.servlet.ServletResponse res)
                   throws javax.servlet.ServletException,
                          IOException
Specified by:
service in interface javax.servlet.Servlet
Overrides:
service in class javax.servlet.http.HttpServlet
Throws:
javax.servlet.ServletException
IOException

onSocketOpened

protected void onSocketOpened(WebSocket socket)
                       throws IOException
Called when a new websocket is opened.

Parameters:
socket - A reference to the WebSocket writer interface
Throws:
IOException

onSocketClosed

protected void onSocketClosed(WebSocket socket)
                       throws IOException
Called when the websocket is closed.

Throws:
IOException

onReceivedFrame

protected void onReceivedFrame(WebSocket socket)
                        throws IOException
Called when a new text frame is received.

Parameters:
socket - A reference to the WebSocket writer interface associated with this socket.
Throws:
IOException

Errai 3.0.1-SNAPSHOT

Copyright © 2013-2014 JBoss, a division of Red Hat. All Rights Reserved.