org.mortbay.cometd
Class AbstractCometdServlet
java.lang.Object
javax.servlet.GenericServlet
org.mortbay.cometd.AbstractCometdServlet
- All Implemented Interfaces:
- java.io.Serializable, Servlet, ServletConfig
- Direct Known Subclasses:
- ContinuationCometdServlet
public abstract class AbstractCometdServlet
- extends GenericServlet
Cometd Filter Servlet implementing the AbstractBayeux
protocol.
The Servlet can be initialized with a json file mapping channels to
DataFilter
definitions. The servlet init parameter "filters" should
point to a webapplication resource containing a JSON array of filter
definitions. For example:
[
{
"channels": "/**",
"class" : "org.mortbay.cometd.filter.NoMarkupFilter",
"init" : {}
}
]
The following init parameters can be used to configure the servlet:
- timeout
- The server side poll timeout in milliseconds (default 250000). This is how
long the server will hold a reconnect request before responding.
- interval
- The client side poll timeout in milliseconds (default 0). How long a client
will wait between reconnects
- maxInterval
- The max client side poll timeout in milliseconds (default 30000). A client will
be removed if a connection is not received in this time.
- multiFrameInterval
- the client side poll timeout
if multiple connections are detected from the same browser (default 1500).
- JSONCommented
- If "true" then the server will accept JSON wrapped
in a comment and will generate JSON wrapped in a comment. This is a defence against
Ajax Hijacking.
- filters
- the location of a JSON file describing
DataFilter
instances to be installed
- requestAvailable
- If true, the current request is made available via the
AbstractBayeux.getCurrentRequest()
method
- loglevel
- 0=none, 1=info, 2=debug
- directDeliver
- true if published messages are delivered directly to subscribers (default). If false, a message copy is created with only supported fields (default true).
- refsThreshold
- The number of message refs at which the a single message response will be
cached instead of being generated for every client delivered to. Done to optimize
a single message being sent to multiple clients.
- Author:
- gregw, aabeling: added JSONP transport
- See Also:
AbstractBayeux}
,
ChannelId}
,
Serialized Form
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
CLIENT_ATTR
public static final java.lang.String CLIENT_ATTR
- See Also:
- Constant Field Values
TRANSPORT_ATTR
public static final java.lang.String TRANSPORT_ATTR
- See Also:
- Constant Field Values
MESSAGE_PARAM
public static final java.lang.String MESSAGE_PARAM
- See Also:
- Constant Field Values
TUNNEL_INIT_PARAM
public static final java.lang.String TUNNEL_INIT_PARAM
- See Also:
- Constant Field Values
HTTP_CLIENT_ID
public static final java.lang.String HTTP_CLIENT_ID
- See Also:
- Constant Field Values
BROWSER_ID
public static final java.lang.String BROWSER_ID
- See Also:
- Constant Field Values
_bayeux
protected AbstractBayeux _bayeux
__DEFAULT_REFS_THRESHOLD
public static final int __DEFAULT_REFS_THRESHOLD
- See Also:
- Constant Field Values
_refsThreshold
protected int _refsThreshold
AbstractCometdServlet
public AbstractCometdServlet()
getBayeux
public AbstractBayeux getBayeux()
newBayeux
protected abstract AbstractBayeux newBayeux()
init
public void init()
throws ServletException
- Description copied from class:
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 GenericServlet
- Throws:
ServletException
- if an exception occurs that
interrupts the servlet's
normal operation
service
protected abstract void service(HttpServletRequest req,
HttpServletResponse resp)
throws ServletException,
java.io.IOException
- Throws:
ServletException
java.io.IOException
service
public void service(ServletRequest req,
ServletResponse resp)
throws ServletException,
java.io.IOException
- Description copied from class:
GenericServlet
- Called by the servlet container to allow the servlet to respond to
a request. See
Servlet.service(javax.servlet.ServletRequest, javax.servlet.ServletResponse)
.
This method is declared abstract so subclasses, such as
HttpServlet
, must override it.
- Specified by:
service
in interface Servlet
- Specified by:
service
in class GenericServlet
- Parameters:
req
- the ServletRequest
object
that contains the client's requestresp
- the ServletResponse
object
that will contain the servlet's response
- Throws:
ServletException
- if an exception occurs that
interferes with the servlet's
normal operation occurred
java.io.IOException
- if an input or output
exception occurs
browserId
protected java.lang.String browserId(HttpServletRequest request)
newBrowserId
protected java.lang.String newBrowserId(HttpServletRequest request,
HttpServletResponse response)
getMessages
protected org.cometd.Message[] getMessages(HttpServletRequest request)
throws java.io.IOException
- Throws:
java.io.IOException
Copyright © 1995-2009 Mort Bay Consulting. All Rights Reserved.