Package org.igniterealtime.jbosh
Class ApacheHTTPResponse
java.lang.Object
org.igniterealtime.jbosh.ApacheHTTPResponse
- All Implemented Interfaces:
HTTPResponse
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final StringName of the accept encoding header.private static final StringValue to use for the ACCEPT_ENCODING header.private AbstractBodyThe response body which was received from the server ornullif that has not yet happened.private static final StringName of the character set to encode the body to/from.private final org.apache.http.client.HttpClientHttpClient instance to use to communicate.private static final StringContent type to use when transmitting the body data.private final org.apache.http.protocol.HttpContextThe execution state of an HTTP process.private final LockLock used for internal synchronization.private final org.apache.http.client.methods.HttpPostThe HTTP POST request is sent to the server.private booleanA flag which indicates if the transmission was already done.private intThe HTTP response status code.private BOSHExceptionException to throw when the response data is attempted to be accessed, ornullif no exception should be thrown. -
Constructor Summary
ConstructorsConstructorDescriptionApacheHTTPResponse(org.apache.http.client.HttpClient client, BOSHClientConfig cfg, CMSessionParams params, AbstractBody request) Create and send a new request to the upstream connection manager, providing deferred access to the results to be returned. -
Method Summary
Modifier and TypeMethodDescriptionvoidabort()Abort the client transmission and response processing.private voidAwait the response, storing the result in the instance variables of this class when they arrive.getBody()Wait for and then return the response body.intWait for and then return the response HTTP status code.
-
Field Details
-
ACCEPT_ENCODING
Name of the accept encoding header.- See Also:
-
ACCEPT_ENCODING_VAL
Value to use for the ACCEPT_ENCODING header. -
CHARSET
Name of the character set to encode the body to/from.- See Also:
-
CONTENT_TYPE
Content type to use when transmitting the body data.- See Also:
-
lock
Lock used for internal synchronization. -
context
private final org.apache.http.protocol.HttpContext contextThe execution state of an HTTP process. -
client
private final org.apache.http.client.HttpClient clientHttpClient instance to use to communicate. -
post
private final org.apache.http.client.methods.HttpPost postThe HTTP POST request is sent to the server. -
sent
private boolean sentA flag which indicates if the transmission was already done. -
toThrow
Exception to throw when the response data is attempted to be accessed, ornullif no exception should be thrown. -
body
The response body which was received from the server ornullif that has not yet happened. -
statusCode
private int statusCodeThe HTTP response status code.
-
-
Constructor Details
-
ApacheHTTPResponse
ApacheHTTPResponse(org.apache.http.client.HttpClient client, BOSHClientConfig cfg, CMSessionParams params, AbstractBody request) Create and send a new request to the upstream connection manager, providing deferred access to the results to be returned.- Parameters:
client- client instance to use when sending the requestcfg- client configurationparams- connection manager parameters from the session creation response, ornullif the session has not yet been establishedrequest- body of the client request
-
-
Method Details
-
abort
public void abort()Abort the client transmission and response processing.- Specified by:
abortin interfaceHTTPResponse
-
getBody
Wait for and then return the response body.- Specified by:
getBodyin interfaceHTTPResponse- Returns:
- body of the response
- Throws:
InterruptedException- if interrupted while awaiting the responseBOSHException- on communication failure
-
getHTTPStatus
Wait for and then return the response HTTP status code.- Specified by:
getHTTPStatusin interfaceHTTPResponse- Returns:
- HTTP status code of the response
- Throws:
InterruptedException- if interrupted while awaiting the responseBOSHException- on communication failure
-
awaitResponse
Await the response, storing the result in the instance variables of this class when they arrive.- Throws:
InterruptedException- if interrupted while awaiting the responseBOSHException- on communication failure
-