Openfire 3.9.3 Javadoc

org.jivesoftware.openfire.http
Class HttpConnection

java.lang.Object
  extended by org.jivesoftware.openfire.http.HttpConnection

public class HttpConnection
extends Object

Represents one HTTP connection with a client using the HTTP Binding service. The client will wait on getResponse() until the server forwards a message to it or the wait time on the session timeout.

Author:
Alexander Wenckus

Constructor Summary
HttpConnection(long requestId, boolean isSecure, X509Certificate[] sslCertificates)
          Constructs an HTTP Connection.
 
Method Summary
 void close()
          The connection should be closed without delivering a stanza to the requestor.
 void deliverBody(String body)
          Delivers content to the client.
 X509Certificate[] getPeerCertificates()
          Returns the peer certificates for this connection.
 long getRequestId()
          Returns the ID which uniquely identifies this connection.
 String getResponse()
          A call that will suspend the request if there is no deliverable currently available.
 HttpSession getSession()
          Returns the session that this connection belongs to.
 boolean isClosed()
          Returns true if this connection has been closed, either a response was delivered to the client or the server closed the connection abruptly.
 boolean isExpired()
           
 boolean isSecure()
          Returns true if this connection is using HTTPS.
 boolean isSuspended()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

HttpConnection

public HttpConnection(long requestId,
                      boolean isSecure,
                      X509Certificate[] sslCertificates)
Constructs an HTTP Connection.

Parameters:
requestId - the ID which uniquely identifies this request.
isSecure - true if this connection is using HTTPS
sslCertificates - list of certificates presented by the client.
Method Detail

close

public void close()
The connection should be closed without delivering a stanza to the requestor.


isClosed

public boolean isClosed()
Returns true if this connection has been closed, either a response was delivered to the client or the server closed the connection abruptly.

Returns:
true if this connection has been closed.

isSecure

public boolean isSecure()
Returns true if this connection is using HTTPS.

Returns:
true if this connection is using HTTPS.

deliverBody

public void deliverBody(String body)
                 throws HttpConnectionClosedException
Delivers content to the client. The content should be valid XMPP wrapped inside of a body. A null value for body indicates that the connection should be closed and the client sent an empty body.

Parameters:
body - the XMPP content to be forwarded to the client inside of a body tag.
Throws:
HttpConnectionClosedException - when this connection to the client has already received a deliverable to forward to the client

getResponse

public String getResponse()
                   throws org.jivesoftware.openfire.http.HttpBindTimeoutException
A call that will suspend the request if there is no deliverable currently available. Once the response becomes available, it is returned.

Returns:
the deliverable to send to the client
Throws:
HttpBindTimeoutException - to indicate that the maximum wait time requested by the client has been surpassed and an empty response should be returned.

getRequestId

public long getRequestId()
Returns the ID which uniquely identifies this connection.

Returns:
the ID which uniquely identifies this connection.

getSession

public HttpSession getSession()
Returns the session that this connection belongs to.

Returns:
the session that this connection belongs to.

getPeerCertificates

public X509Certificate[] getPeerCertificates()
Returns the peer certificates for this connection.

Returns:
the peer certificates for this connection or null.

isSuspended

public boolean isSuspended()

isExpired

public boolean isExpired()

toString

public String toString()
Overrides:
toString in class Object

Openfire 3.9.3 Javadoc

Copyright © 2003-2008 Jive Software.