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

## org.jivesoftware.openfire.http
Class HttpSessionManager

    java.lang.Object
      org.jivesoftware.openfire.http.HttpSessionManager

    public class HttpSessionManager

extends Object

Manages sessions for all users connecting to Openfire using the HTTP binding protocal, XEP-0124.

Constructor Summary
`HttpSessionManager()` Creates a new HttpSessionManager instance.

Method Summary
`HttpSession` | `createSession(InetAddress address, org.dom4j.Element rootNode, HttpConnection connection)` Creates an HTTP binding session which will allow a user to exchange packets with Openfire.
`HttpConnection` | `forwardRequest(long rid, HttpSession session, boolean isSecure, org.dom4j.Element rootNode)` Forwards a client request, which is related to a session, to the server.
`int` | `getInactivityTimeout()` Seconds a session has to be idle to be closed.
`int` | `getMaxPause()` Returns the maximum length of a temporary session pause (in seconds) that the client MAY request.
`int` | `getMaxRequests()` Openfire MAY limit the number of simultaneous requests the client makes with the 'requests' attribute.
`int` | `getMaxWait()` Returns the longest time (in seconds) that Openfire is allowed to wait before responding to any request during the session.
`int` | `getPollingInactivityTimeout()` Seconds a polling session has to be idle to be closed.
`int` | `getPollingInterval()` Openfire SHOULD include two additional attributes in the session creation response element, specifying the shortest allowable polling interval and the longest allowable inactivity period (both in seconds).
`HttpSession` | `getSession(String streamID)` Returns the session related to a stream id.
`void` | `start()` Starts the services used by the HttpSessionManager.
`void` | `stop()` Stops any services and cleans up any resources used by the HttpSessionManager.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### HttpSessionManager

    public HttpSessionManager()

  Creates a new HttpSessionManager instance.

Method Detail

### start

    public void start()

  Starts the services used by the HttpSessionManager.

### stop

    public void stop()

  Stops any services and cleans up any resources used by the HttpSessionManager.

### getSession

    public HttpSession getSession(String streamID)

  Returns the session related to a stream id.

  Parameters:
    `streamID` - the stream id to retrieve the session.
  Returns:
    the session related to the provided stream id.

### createSession

    public HttpSession createSession(InetAddress address,
                                     org.dom4j.Element rootNode,
                                     HttpConnection connection)
                              throws UnauthorizedException,
                                     HttpBindException

  Creates an HTTP binding session which will allow a user to exchange packets with Openfire.

  Parameters:
    `address` - the internet address that was used to bind to Wildfie.
    `rootNode` - the body element that was sent containing the request for a new session.
    `connection` - the HTTP connection object which abstracts the individual connections to Openfire over the HTTP binding protocol. The initial session creation response is returned to this connection.
  Returns:
    the created HTTP session.
  Throws:
    `UnauthorizedException` - if the Openfire server is currently in an uninitialized state. Either shutting down or starting up.
    `HttpBindException` - when there is an internal server error related to the creation of the initial session creation response.

### getMaxPause

    public int getMaxPause()

  Returns the maximum length of a temporary session pause (in seconds) that the client MAY request.

  Returns:
    the maximum length of a temporary session pause (in seconds) that the client MAY request.

### getMaxWait

    public int getMaxWait()

  Returns the longest time (in seconds) that Openfire is allowed to wait before responding to any request during the session. This enables the client to prevent its TCP connection from expiring due to inactivity, as well as to limit the delay before it discovers any network failure.

  Returns:
    the longest time (in seconds) that Openfire is allowed to wait before responding to any request during the session.

### getPollingInterval

    public int getPollingInterval()

  Openfire SHOULD include two additional attributes in the session creation response element, specifying the shortest allowable polling interval and the longest allowable inactivity period (both in seconds). Communication of these parameters enables the client to engage in appropriate behavior (e.g., not sending empty request elements more often than desired, and ensuring that the periods with no requests pending are never too long).

  Returns:
    the maximum allowable period over which a client can send empty requests to the server.

### getMaxRequests

    public int getMaxRequests()

  Openfire MAY limit the number of simultaneous requests the client makes with the 'requests' attribute. The RECOMMENDED value is "2". Servers that only support polling behavior MUST prevent clients from making simultaneous requests by setting the 'requests' attribute to a value of "1" (however, polling is NOT RECOMMENDED). In any case, clients MUST NOT make more simultaneous requests than specified by the Openfire.

  Returns:
    the number of simultaneous requests allowable.

### getInactivityTimeout

    public int getInactivityTimeout()

  Seconds a session has to be idle to be closed. Default is 30. Sending stanzas to the client is not considered as activity. We are only considering the connection active when the client sends some data or hearbeats (i.e. whitespaces) to the server. The reason for this is that sending data will fail if the connection is closed. And if the thread is blocked while sending data (because the socket is closed) then the clean up thread will close the socket anyway.

  Returns:
    Seconds a session has to be idle to be closed.

### getPollingInactivityTimeout

    public int getPollingInactivityTimeout()

  Seconds a polling session has to be idle to be closed. Default is 60. Sending stanzas to the client is not considered as activity. We are only considering the connection active when the client sends some data or hearbeats (i.e. whitespaces) to the server. The reason for this is that sending data will fail if the connection is closed. And if the thread is blocked while sending data (because the socket is closed) then the clean up thread will close the socket anyway.

  Returns:
    Seconds a polling session has to be idle to be closed.

### forwardRequest

    public HttpConnection forwardRequest(long rid,
                                         HttpSession session,
                                         boolean isSecure,
                                         org.dom4j.Element rootNode)
                                  throws HttpBindException,
                                         HttpConnectionClosedException

  Forwards a client request, which is related to a session, to the server. A connection is created and queued up in the provided session. When a connection reaches the top of a queue any pending packets bound for the client will be forwarded to the client through the connection.

  Parameters:
    `rid` - the unique, sequential, requestID sent from the client.
    `session` - the HTTP session of the client that made the request.
    `isSecure` - true if the request was made over a secure channel, HTTPS, and false if it was not.
    `rootNode` - the XML body of the request.
  Returns:
    the created HTTP connection.
  Throws:
    `HttpBindException` - for several reasons: if the encoding inside of an auth packet is not recognized by the server, or if the packet type is not recognized.
    `HttpConnectionClosedException` - if the session is no longer available.

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

Copyright © 2003-2008 Jive Software.