CometEvent (Tomcat API Documentation)
Keywords: org.apache.catalina.CometEvent interface

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.catalina
Interface CometEvent

All Known Implementing Classes:
  CometEventImpl

    public interface CometEvent

The CometEvent interface.

Author:
  Filip Hanik, Remy Maucherat

Nested Class Summary
`static class` | `CometEvent.EventSubType` Event details TIMEOUT - the connection timed out (sub type of ERROR); note that this ERROR type is not fatal, and the connection will not be closed unless the servlet uses the close method of the event CLIENT_DISCONNECT - the client connection was closed (sub type of ERROR) IOEXCEPTION - an IO exception occurred, such as invalid content, for example, an invalid chunk block (sub type of ERROR) WEBAPP_RELOAD - the webapplication is being reloaded (sub type of END) SERVER_SHUTDOWN - the server is shutting down (sub type of END) SESSION_END - the servlet ended the session (sub type of END)
`static class` | `CometEvent.EventType` Enumeration describing the major events that the container can invoke the CometProcessors event() method with BEGIN - will be called at the beginning of the processing of the connection.

Method Summary
`void` | `close()` Ends the Comet session.
`CometEvent.EventSubType` | `getEventSubType()` Returns the sub type of this event.
`CometEvent.EventType` | `getEventType()` Returns the event type.
`javax.servlet.http.HttpServletRequest` | `getHttpServletRequest()` Returns the HttpServletRequest.
`javax.servlet.http.HttpServletResponse` | `getHttpServletResponse()` Returns the HttpServletResponse.
`void` | `setTimeout(int timeout)` Sets the timeout for this Comet connection.

Method Detail

### getHttpServletRequest

    javax.servlet.http.HttpServletRequest getHttpServletRequest()

  Returns the HttpServletRequest.

  Returns:
    HttpServletRequest

### getHttpServletResponse

    javax.servlet.http.HttpServletResponse getHttpServletResponse()

  Returns the HttpServletResponse.

  Returns:
    HttpServletResponse

### getEventType

    CometEvent.EventType getEventType()

  Returns the event type.

  Returns:
    EventType

### getEventSubType

    CometEvent.EventSubType getEventSubType()

  Returns the sub type of this event.

  Returns:
    EventSubType

### close

    void close()
               throws java.io.IOException

  Ends the Comet session. This signals to the container that the container wants to end the comet session. This will send back to the client a notice that the server has no more data to send as part of this request. The servlet should perform any needed cleanup as if it had recieved an END or ERROR event.

  Throws:
    `java.io.IOException` - if an IO exception occurs

### setTimeout

    void setTimeout(int timeout)
                    throws java.io.IOException,
                           javax.servlet.ServletException,
                           java.lang.UnsupportedOperationException

  Sets the timeout for this Comet connection. Please NOTE, that the implementation of a per connection timeout is OPTIONAL and MAY NOT be implemented.
  This method sets the timeout in milliseconds of idle time on the connection. The timeout is reset every time data is received from the connection or data is flushed using `response.flushBuffer()`. If a timeout occurs, the `error(HttpServletRequest, HttpServletResponse)` method is invoked. The web application SHOULD NOT attempt to reuse the request and response objects after a timeout as the `error(HttpServletRequest, HttpServletResponse)` method indicates.
  This method should not be called asynchronously, as that will have no effect.

  Parameters:
    `timeout` - The timeout in milliseconds for this connection, must be a positive value, larger than 0
  Throws:
    `java.io.IOException` - An IOException may be thrown to indicate an IO error, or that the EOF has been reached on the connection
    `javax.servlet.ServletException` - An exception has occurred, as specified by the root cause
    `java.lang.UnsupportedOperationException` - if per connection timeout is not supported, either at all or at this phase of the invocation.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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