Class HttpSessionManager


  • public class HttpSessionManager
    extends Object
    Manages sessions for all users connecting to Openfire using the HTTP binding protocol, XEP-0124.
    • Constructor Detail

      • HttpSessionManager

        public HttpSessionManager()
        Creates a new HttpSessionManager instance.
    • Method Detail

      • init

        @Deprecated
        public void init()
        Deprecated.
        As of Openfire 4.0.0, the functionality of this method was added to the implementation of #start().
      • start

        public void start()
        Starts the services used by the HttpSessionManager. (Re)creates and configures a pooled executor to handle async routing for incoming packets with a configurable (through property "xmpp.httpbind.worker.threads") amount of threads; also uses an unbounded task queue and configurable ("xmpp.httpbind.worker.timeout") keep-alive. Note: Apart from the processing threads configured in this class, the server also uses a threadpool to perform the network IO (as configured in (HttpBindManager). BOSH installations expecting heavy loads may want to allocate additional threads to this worker pool to ensure timely delivery of inbound packets
      • 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​(HttpBindBody body,
                                         HttpConnection connection)
                                  throws UnauthorizedException,
                                         HttpBindException,
                                         UnknownHostException
        Creates an HTTP binding session which will allow a user to exchange packets with Openfire.
        Parameters:
        body - 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.
        UnknownHostException - if no IP address for the peer could be found
      • 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.
      • execute

        protected void execute​(Runnable runnable)