Accela SDK for Android  V3.0
 All Classes Functions Variables Pages
com.accela.mobile.http.AsyncHttpClient Class Reference

Public Member Functions

 AsyncHttpClient ()
 
void setCookieStore (CookieStore cookieStore)
 
void setThreadPool (ThreadPoolExecutor threadPool)
 
void setUserAgent (String userAgent)
 
void setSSLSocketFactory (SSLSocketFactory sslSocketFactory)
 
void addHeader (String header, String value)
 
void cancelRequests (Context context, boolean mayInterruptIfRunning)
 
Boolean isCancelled ()
 
void get (String url, AsyncHttpResponseHandler responseHandler)
 
void get (String url, RequestParams params, AsyncHttpResponseHandler responseHandler)
 
void get (Context context, String url, AsyncHttpResponseHandler responseHandler)
 
void get (Context context, String url, RequestParams params, AsyncHttpResponseHandler responseHandler)
 
void get (Context context, String url, Header[] headers, RequestParams params, AsyncHttpResponseHandler responseHandler)
 
void post (String url, AsyncHttpResponseHandler responseHandler)
 
void post (String url, RequestParams params, AsyncHttpResponseHandler responseHandler)
 
void post (Context context, String url, RequestParams params, AsyncHttpResponseHandler responseHandler)
 
void post (Context context, String url, HttpEntity entity, String contentType, AsyncHttpResponseHandler responseHandler)
 
void post (Context context, String url, Header[] headers, RequestParams params, String contentType, AsyncHttpResponseHandler responseHandler)
 
void put (String url, AsyncHttpResponseHandler responseHandler)
 
void put (String url, RequestParams params, AsyncHttpResponseHandler responseHandler)
 
void put (Context context, String url, RequestParams params, AsyncHttpResponseHandler responseHandler)
 
void put (Context context, String url, HttpEntity entity, String contentType, AsyncHttpResponseHandler responseHandler)
 
void put (Context context, String url, Header[] headers, HttpEntity entity, String contentType, AsyncHttpResponseHandler responseHandler)
 
void delete (String url, AsyncHttpResponseHandler responseHandler)
 
void delete (Context context, String url, AsyncHttpResponseHandler responseHandler)
 
void delete (Context context, String url, Header[] headers, AsyncHttpResponseHandler responseHandler)
 
Boolean isLoading ()
 
String assembleUrlWithParams (String url, RequestParams params)
 
Map< String, String > getHeader ()
 
List< NameValuePair > getHttpResponseHeaders ()
 

Detailed Description

 Accela Amobile
 File: AsyncHttpClient.java
 Accela, Inc.
 Copyright (C): 2012
 Description:
 HTTP Client wrapper object, used to process asynchronous HTTP requests.
 Notes:
 Revision History

   @since 1.0
 

Constructor & Destructor Documentation

com.accela.mobile.http.AsyncHttpClient.AsyncHttpClient ( )
inline

Constructor without parameters.

Returns
An initialized AsyncHttpClient instance
Since
1.0

Member Function Documentation

void com.accela.mobile.http.AsyncHttpClient.addHeader ( String  header,
String  value 
)
inline

Sets headers that will be added to all requests this client makes (before sending).

Parameters
headerThe name of the header
valueThe contents of the header
Returns
Void.
Since
1.0
String com.accela.mobile.http.AsyncHttpClient.assembleUrlWithParams ( String  url,
RequestParams  params 
)
inline

Append request parameters to URL.

Parameters
urlThe URL to send the request to.
paramsAdditional URL parameters which will be appended to the URL.
Returns
A new URL string which contains the parameter key-value pairs.
Since
1.0
void com.accela.mobile.http.AsyncHttpClient.cancelRequests ( Context  context,
boolean  mayInterruptIfRunning 
)
inline

Cancels any pending (or potentially active) requests associated with the passed Context.

Note: This will only affect requests which were created with a non-null Android Context. This method is intended to be used in the onDestroy method of your Android activities to destroy all requests which are no longer required.

Parameters
contextThe Android Context instance associated to the request.
mayInterruptIfRunningSpecifies if active requests should be cancelled along with pending requests.
Returns
Void.
Since
1.0
void com.accela.mobile.http.AsyncHttpClient.delete ( String  url,
AsyncHttpResponseHandler  responseHandler 
)
inline

Perform a HTTP DELETE request.

Parameters
urlThe URL to send the request to.
responseHandlerThe response handler instance that should handle the response.
Returns
Void.
Since
1.0
void com.accela.mobile.http.AsyncHttpClient.delete ( Context  context,
String  url,
AsyncHttpResponseHandler  responseHandler 
)
inline

Perform a HTTP DELETE request.

Parameters
contextThe Android Context which initiated the request.
urlThe URL to send the request to.
responseHandlerThe response handler instance that should handle the response.
Returns
Void.
Since
1.0
void com.accela.mobile.http.AsyncHttpClient.delete ( Context  context,
String  url,
Header[]  headers,
AsyncHttpResponseHandler  responseHandler 
)
inline

Perform a HTTP DELETE request.

Parameters
contextThe Android Context which initiated the request.
urlThe URL to send the request to.
headersSet one-time headers for this request
responseHandlerThe response handler instance that should handle the response.
Returns
Void.
Since
1.0
void com.accela.mobile.http.AsyncHttpClient.get ( String  url,
AsyncHttpResponseHandler  responseHandler 
)
inline

Perform a HTTP GET request, without any parameters.

Parameters
urlThe URL to send the request to.
responseHandlerThe response handler instance that should handle the response.
Returns
Void.
Since
1.0
void com.accela.mobile.http.AsyncHttpClient.get ( String  url,
RequestParams  params,
AsyncHttpResponseHandler  responseHandler 
)
inline

Perform a HTTP GET request with parameters.

Parameters
urlThe URL to send the request to.
paramsAdditional GET parameters to send with the request.
responseHandlerThe response handler instance that should handle the response.
Returns
Void.
Since
1.0
void com.accela.mobile.http.AsyncHttpClient.get ( Context  context,
String  url,
AsyncHttpResponseHandler  responseHandler 
)
inline

Perform a HTTP GET request without any parameters and track the Android Context which initiated the request.

Parameters
contextThe Android Context which initiated the request.
urlThe URL to send the request to.
responseHandlerThe response handler instance that should handle the response.
Returns
Void.
Since
1.0
void com.accela.mobile.http.AsyncHttpClient.get ( Context  context,
String  url,
RequestParams  params,
AsyncHttpResponseHandler  responseHandler 
)
inline

Perform a HTTP GET request and track the Android Context which initiated the request.

Parameters
contextThe Android Context which initiated the request.
urlThe URL to send the request to.
paramsAdditional GET parameters to send with the request.
responseHandlerThe response handler instance that should handle the response.
Returns
Void.
Since
1.0
void com.accela.mobile.http.AsyncHttpClient.get ( Context  context,
String  url,
Header[]  headers,
RequestParams  params,
AsyncHttpResponseHandler  responseHandler 
)
inline

Perform a HTTP GET request and track the Android Context which initiated the request with customized headers

Parameters
contextThe Android Context which initiated the request.
urlThe URL to send the request to.
headersSet headers only for this request
paramsAdditional GET parameters to send with the request.
responseHandlerThe response handler instance that should handle the response.
Returns
Void.
Since
1.0
Map<String, String> com.accela.mobile.http.AsyncHttpClient.getHeader ( )
inline

Get client's header map.

Returns
The map which contains client header data..
Since
1.0
List<NameValuePair> com.accela.mobile.http.AsyncHttpClient.getHttpResponseHeaders ( )
inline

Get response's header list.

Returns
The list which contains header of HTTP response
Since
1.0
Boolean com.accela.mobile.http.AsyncHttpClient.isCancelled ( )
inline

Get whether the current HTTP request has been cancelled.

Returns
Return true if the request has been cancelled; Otherwise, return false.
Since
1.0
Boolean com.accela.mobile.http.AsyncHttpClient.isLoading ( )
inline

Get loading status of current HTTP client.

Returns
true if the http client is loading; otherwise return false.
Since
1.0
void com.accela.mobile.http.AsyncHttpClient.post ( String  url,
AsyncHttpResponseHandler  responseHandler 
)
inline

Perform a HTTP POST request, without any parameters.

Parameters
urlThe URL to send the request to.
responseHandlerThe response handler instance that should handle the response.
Returns
Void.
Since
1.0
void com.accela.mobile.http.AsyncHttpClient.post ( String  url,
RequestParams  params,
AsyncHttpResponseHandler  responseHandler 
)
inline

Perform a HTTP POST request with parameters.

Parameters
urlThe URL to send the request to.
paramsAdditional POST parameters or files to send with the request.
responseHandlerThe response handler instance that should handle the response.
Returns
Void.
Since
1.0
void com.accela.mobile.http.AsyncHttpClient.post ( Context  context,
String  url,
RequestParams  params,
AsyncHttpResponseHandler  responseHandler 
)
inline

Perform a HTTP POST request and track the Android Context which initiated the request.

Parameters
contextThe Android Context which initiated the request.
urlThe URL to send the request to.
paramsAdditional POST parameters or files to send with the request.
responseHandlerThe response handler instance that should handle the response.
Returns
Void.
Since
1.0
void com.accela.mobile.http.AsyncHttpClient.post ( Context  context,
String  url,
HttpEntity  entity,
String  contentType,
AsyncHttpResponseHandler  responseHandler 
)
inline

Perform a HTTP POST request and track the Android Context which initiated the request.

Parameters
contextThe Android Context which initiated the request.
urlThe URL to send the request to.
entityA raw HttpEntity to send with the request, for example, use this to send string/json/xml payloads to a server by passing a org.apache.http.entity.StringEntity.
contentTypeThe content type of the payload you are sending, for example application/json if sending a json payload.
responseHandlerThe response handler instance that should handle the response.
Returns
Void.
Since
1.0
void com.accela.mobile.http.AsyncHttpClient.post ( Context  context,
String  url,
Header[]  headers,
RequestParams  params,
String  contentType,
AsyncHttpResponseHandler  responseHandler 
)
inline

Perform a HTTP POST request and track the Android Context which initiated the request. Set headers only for this request

Parameters
contextThe Android Context which initiated the request.
urlThe URL to send the request to.
headersSet headers only for this request
paramsAdditional POST parameters or files to send with the request.
contentTypeThe content type of the payload you are sending, for example application/json if sending a json payload.
responseHandlerThe response handler instance that should handle the response.
Returns
Void.
Since
1.0
void com.accela.mobile.http.AsyncHttpClient.put ( String  url,
AsyncHttpResponseHandler  responseHandler 
)
inline

Perform a HTTP PUT request, without any parameters.

Parameters
urlThe URL to send the request to.
responseHandlerThe response handler instance that should handle the response.
Returns
Void.
Since
1.0
void com.accela.mobile.http.AsyncHttpClient.put ( String  url,
RequestParams  params,
AsyncHttpResponseHandler  responseHandler 
)
inline

Perform a HTTP PUT request with parameters.

Parameters
urlThe URL to send the request to.
paramsAdditional PUT parameters or files to send with the request.
responseHandlerThe response handler instance that should handle the response.
Returns
Void.
Since
1.0
void com.accela.mobile.http.AsyncHttpClient.put ( Context  context,
String  url,
RequestParams  params,
AsyncHttpResponseHandler  responseHandler 
)
inline

Perform a HTTP PUT request and track the Android Context which initiated the request.

Parameters
contextThe Android Context which initiated the request.
urlThe URL to send the request to.
paramsAdditional PUT parameters or files to send with the request.
responseHandlerThe response handler instance that should handle the response.
Returns
Void.
Since
1.0
void com.accela.mobile.http.AsyncHttpClient.put ( Context  context,
String  url,
HttpEntity  entity,
String  contentType,
AsyncHttpResponseHandler  responseHandler 
)
inline

Perform a HTTP PUT request and track the Android Context which initiated the request. And set one-time headers for the request

Parameters
contextThe Android Context which initiated the request.
urlThe URL to send the request to.
entityA raw HttpEntity to send with the request, for example, use this to send string/json/xml payloads to a server by passing a org.apache.http.entity.StringEntity.
contentTypeThe content type of the payload you are sending, for example application/json if sending a json payload.
responseHandlerThe response handler instance that should handle the response.
Returns
Void.
Since
1.0
void com.accela.mobile.http.AsyncHttpClient.put ( Context  context,
String  url,
Header[]  headers,
HttpEntity  entity,
String  contentType,
AsyncHttpResponseHandler  responseHandler 
)
inline

Perform a HTTP PUT request and track the Android Context which initiated the request. And set one-time headers for the request

Parameters
contextThe Android Context which initiated the request.
urlThe URL to send the request to.
headersSet one-time headers for this request
entityA raw HttpEntity to send with the request, for example, use this to send string/json/xml payloads to a server by passing a org.apache.http.entity.StringEntity.
contentTypeThe content type of the payload you are sending, for example application/json if sending a json payload.
responseHandlerThe response handler instance that should handle the response.
Returns
Void.
Since
1.0
void com.accela.mobile.http.AsyncHttpClient.setCookieStore ( CookieStore  cookieStore)
inline

Sets an optional CookieStore to use when making requests

Parameters
cookieStoreThe CookieStore implementation to use, usually an instance of PersistentCookieStore
Returns
Void.
Since
1.0
void com.accela.mobile.http.AsyncHttpClient.setSSLSocketFactory ( SSLSocketFactory  sslSocketFactory)
inline

Sets the SSLSocketFactory to user when making requests. By default, a new, default SSLSocketFactory is used.

Parameters
sslSocketFactoryThe socket factory to use for https requests.
Returns
Void.
Since
1.0
void com.accela.mobile.http.AsyncHttpClient.setThreadPool ( ThreadPoolExecutor  threadPool)
inline

Overrides the threadpool implementation used when queuing/pooling requests. By default, Executors.newCachedThreadPool() is used.

Parameters
threadPoolAn instance of ThreadPoolExecutor to use for queuing/pooling requests.
Returns
Void.
Since
1.0
void com.accela.mobile.http.AsyncHttpClient.setUserAgent ( String  userAgent)
inline

Sets the User-Agent header to be sent with each request.

Parameters
userAgentThe string to use in the User-Agent header.
Returns
Void.
Since
1.0

The documentation for this class was generated from the following file: