org.apache.tomcat.bayeux
Class BayeuxServlet

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by org.apache.tomcat.bayeux.BayeuxServlet
All Implemented Interfaces:
java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig, org.jboss.servlet.http.HttpEventServlet

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

Version:
1.0
Author:
Filip Hanik, Guy Molinari
See Also:
Serialized Form

Field Summary
protected  int reconnectInterval
          The reconnect interval.
protected  TomcatBayeux tb
          Reference to the global TomcatBayeux object
protected  int timeout
          The timeout.
static java.lang.String TOMCAT_BAYEUX_ATTR
          Attribute to hold the TomcatBayeux object in the servlet context
 
Constructor Summary
BayeuxServlet()
           
 
Method Summary
protected  void checkBayeux(org.jboss.servlet.http.HttpEvent cometEvent)
           
 void destroy()
          Upon servlet destruction, the servlet will clean up the TomcatBayeux object and terminate any outstanding events.
 void event(org.jboss.servlet.http.HttpEvent cometEvent)
          Process the given IO event.
protected  int getReconnectInterval()
           
 java.lang.String getServletInfo()
          Returns information about the servlet, such as author, version, and copyright.
protected  int getTimeout()
          Returns the preconfigured connection timeout.
protected  int handleBayeux(java.lang.String message, org.jboss.servlet.http.HttpEvent event)
           
 void init()
          A convenience method which can be overridden so that there's no need to call super.init(config).
 void service(javax.servlet.ServletRequest servletRequest, javax.servlet.ServletResponse servletResponse)
          Dispatches client requests to the protected service method.
 
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, getServletName, 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
getServletConfig, init
 

Field Detail

timeout

protected int timeout
The timeout.


reconnectInterval

protected int reconnectInterval
The reconnect interval.


TOMCAT_BAYEUX_ATTR

public static final java.lang.String TOMCAT_BAYEUX_ATTR
Attribute to hold the TomcatBayeux object in the servlet context

See Also:
Constant Field Values

tb

protected TomcatBayeux tb
Reference to the global TomcatBayeux object

Constructor Detail

BayeuxServlet

public BayeuxServlet()
Method Detail

destroy

public void destroy()
Upon servlet destruction, the servlet will clean up the TomcatBayeux object and terminate any outstanding events.

Specified by:
destroy in interface javax.servlet.Servlet
Overrides:
destroy in class javax.servlet.GenericServlet

getTimeout

protected int getTimeout()
Returns the preconfigured connection timeout. If no timeout has been configured as a servlet init parameter named timeout then the default of 2min will be used.

Returns:
int - the timeout for a connection in milliseconds

getReconnectInterval

protected int getReconnectInterval()

event

public void event(org.jboss.servlet.http.HttpEvent cometEvent)
           throws java.io.IOException,
                  javax.servlet.ServletException
Description copied from interface: org.jboss.servlet.http.HttpEventServlet
Process the given IO event.

Specified by:
event in interface org.jboss.servlet.http.HttpEventServlet
Parameters:
cometEvent - The event that will be processed
Throws:
java.io.IOException
javax.servlet.ServletException

checkBayeux

protected void checkBayeux(org.jboss.servlet.http.HttpEvent cometEvent)
                    throws java.io.IOException,
                           java.lang.UnsupportedOperationException
Parameters:
cometEvent - CometEvent
Throws:
java.io.IOException
java.lang.UnsupportedOperationException

handleBayeux

protected int handleBayeux(java.lang.String message,
                           org.jboss.servlet.http.HttpEvent event)
                    throws java.io.IOException,
                           javax.servlet.ServletException
Throws:
java.io.IOException
javax.servlet.ServletException

getServletInfo

public java.lang.String getServletInfo()
Description copied from class: javax.servlet.GenericServlet
Returns information about the servlet, such as author, version, and copyright. By default, this method returns an empty string. Override this method to have it return a meaningful value. See Servlet.getServletInfo().

Specified by:
getServletInfo in interface javax.servlet.Servlet
Overrides:
getServletInfo in class javax.servlet.GenericServlet
Returns:
String information about this servlet, by default an empty string

init

public void init()
          throws javax.servlet.ServletException
Description copied from class: javax.servlet.GenericServlet
A convenience method which can be overridden so that there's no need to call super.init(config).

Instead of overriding GenericServlet.init(ServletConfig), simply override this method and it will be called by GenericServlet.init(ServletConfig config). The ServletConfig object can still be retrieved via GenericServlet.getServletConfig().

Overrides:
init in class javax.servlet.GenericServlet
Throws:
javax.servlet.ServletException - if an exception occurs that interrupts the servlet's normal operation

service

public void service(javax.servlet.ServletRequest servletRequest,
                    javax.servlet.ServletResponse servletResponse)
             throws javax.servlet.ServletException,
                    java.io.IOException
Description copied from class: javax.servlet.http.HttpServlet
Dispatches client requests to the protected service method. There's no need to override this method.

Specified by:
service in interface javax.servlet.Servlet
Overrides:
service in class javax.servlet.http.HttpServlet
Parameters:
servletRequest - the HttpServletRequest object that contains the request the client made of the servlet
servletResponse - the HttpServletResponse object that contains the response the servlet returns to the client
Throws:
javax.servlet.ServletException - if the HTTP request cannot be handled
java.io.IOException - if an input or output error occurs while the servlet is handling the HTTP request
See Also:
Servlet.service(javax.servlet.ServletRequest, javax.servlet.ServletResponse)


Copyright © 2000-2008 Apache Software Foundation. All Rights Reserved.