Package org.igniterealtime.jbosh
Class ApacheHTTPSender
java.lang.Object
org.igniterealtime.jbosh.ApacheHTTPSender
- All Implemented Interfaces:
HTTPSender
Implementation of the
HTTPSender
interface which uses the
Apache HttpClient API to send messages to the connection manager.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate BOSHClientConfig
Session configuration.private org.apache.http.client.HttpClient
HttpClient instance to use to communicate.private final Lock
Lock used for internal synchronization. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
destroy()
Dispose of all resources used to provide the required services.void
init
(BOSHClientConfig session) Initialize the HTTP sender instance for use with the session provided.private org.apache.http.client.HttpClient
initHttpClient
(BOSHClientConfig config) send
(CMSessionParams params, AbstractBody body) Create aCallable
instance which can be used to send the request specified to the connection manager.
-
Field Details
-
lock
Lock used for internal synchronization. -
cfg
Session configuration. -
httpClient
private org.apache.http.client.HttpClient httpClientHttpClient instance to use to communicate.
-
-
Constructor Details
-
ApacheHTTPSender
ApacheHTTPSender()Prevent construction apart from our package.
-
-
Method Details
-
init
Initialize the HTTP sender instance for use with the session provided. This method will be called once before use of the service instance.- Specified by:
init
in interfaceHTTPSender
- Parameters:
session
- session configuration
-
destroy
public void destroy()Dispose of all resources used to provide the required services. This method will be called once when the service instance is no longer required.- Specified by:
destroy
in interfaceHTTPSender
-
send
Create aCallable
instance which can be used to send the request specified to the connection manager. This method should return immediately, prior to doing any real work. The invocation of the returnedCallable
should send the request (if it has not already been sent by the time of the call), block while waiting for the response, and then return the response body.- Specified by:
send
in interfaceHTTPSender
- Parameters:
params
- CM session creation resopnse paramsbody
- request body to send- Returns:
- callable used to access the response
-
initHttpClient
-