|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.github.ignition.support.http.IgnitedHttp
public class IgnitedHttp
Field Summary | |
---|---|
static String |
DEFAULT_HTTP_USER_AGENT
|
static int |
DEFAULT_MAX_CONNECTIONS
|
static int |
DEFAULT_SOCKET_TIMEOUT
|
static int |
DEFAULT_WAIT_FOR_CONNECTION_TIMEOUT
|
static String |
ENCODING_GZIP
|
static String |
HEADER_ACCEPT_ENCODING
|
Constructor Summary | |
---|---|
IgnitedHttp()
|
|
IgnitedHttp(android.content.Context context)
|
Method Summary | |
---|---|
IgnitedHttpRequest |
delete(String url)
|
void |
disableResponseCache(boolean wipe)
Disables caching of HTTP responses. |
void |
enableResponseCache(android.content.Context context,
int initialCapacity,
long expirationInMinutes,
int maxConcurrentThreads,
int diskCacheStorageDevice)
Enables caching of HTTP responses. |
void |
enableResponseCache(int initialCapacity,
long expirationInMinutes,
int maxConcurrentThreads)
Enables caching of HTTP responses. |
IgnitedHttpRequest |
get(String url)
|
IgnitedHttpRequest |
get(String url,
boolean cached)
|
HashMap<String,String> |
getDefaultHeaders()
|
org.apache.http.impl.client.AbstractHttpClient |
getHttpClient()
|
HttpResponseCache |
getResponseCache()
|
void |
listenForConnectivityChanges(android.content.Context context)
Registers a broadcast receiver with the application context that will take care of updating proxy settings when failing over between 3G and Wi-Fi. |
IgnitedHttpRequest |
post(String url)
|
IgnitedHttpRequest |
post(String url,
org.apache.http.HttpEntity payload)
|
IgnitedHttpRequest |
put(String url)
|
IgnitedHttpRequest |
put(String url,
org.apache.http.HttpEntity payload)
|
void |
setConnectionTimeout(int connectionTimeout)
Adjust the connection timeout, i.e. |
void |
setDefaultHeader(String header,
String value)
|
void |
setGzipEncodingEnabled(boolean enabled)
|
void |
setHttpClient(org.apache.http.impl.client.AbstractHttpClient httpClient)
|
void |
setMaximumConnections(int maxConnections)
|
void |
setPortForScheme(String scheme,
int port)
|
void |
setSocketTimeout(int socketTimeout)
Adjust the socket timeout, i.e. |
protected void |
setupHttpClient()
|
void |
updateProxySettings(android.content.Context context)
Updates the underlying HTTP client's proxy settings with what the user has entered in the APN settings. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int DEFAULT_MAX_CONNECTIONS
public static final int DEFAULT_SOCKET_TIMEOUT
public static final int DEFAULT_WAIT_FOR_CONNECTION_TIMEOUT
public static final String DEFAULT_HTTP_USER_AGENT
public static final String HEADER_ACCEPT_ENCODING
public static final String ENCODING_GZIP
Constructor Detail |
---|
public IgnitedHttp()
public IgnitedHttp(android.content.Context context)
Method Detail |
---|
protected void setupHttpClient()
public void listenForConnectivityChanges(android.content.Context context)
Manifest.permission#ACCESS_NETWORK_STATE
permission.
context
- the context used to retrieve the app contextpublic void setGzipEncodingEnabled(boolean enabled)
public void enableResponseCache(int initialCapacity, long expirationInMinutes, int maxConcurrentThreads)
enableResponseCache(Context, int, long, int, int)
.
initialCapacity
- the initial element size of the cacheexpirationInMinutes
- time in minutes after which elements will be purged from the cachemaxConcurrentThreads
- how many threads you think may at once access the cache; this need not be an exact
number, but it helps in fragmenting the cache properlyHttpResponseCache
public void enableResponseCache(android.content.Context context, int initialCapacity, long expirationInMinutes, int maxConcurrentThreads, int diskCacheStorageDevice)
context
- the current contextinitialCapacity
- the initial element size of the cacheexpirationInMinutes
- time in minutes after which elements will be purged from the cache (NOTE: this
only affects the memory cache, the disk cache does currently NOT handle element
TTLs!)maxConcurrentThreads
- how many threads you think may at once access the cache; this need not be an exact
number, but it helps in fragmenting the cache properlydiskCacheStorageDevice
- where files should be cached persistently (
AbstractCache.DISK_CACHE_INTERNAL
, AbstractCache.DISK_CACHE_SDCARD
)HttpResponseCache
public void disableResponseCache(boolean wipe)
public HttpResponseCache getResponseCache()
public void setHttpClient(org.apache.http.impl.client.AbstractHttpClient httpClient)
public org.apache.http.impl.client.AbstractHttpClient getHttpClient()
public void updateProxySettings(android.content.Context context)
listenForConnectivityChanges(Context)
has been called. This requires the Manifest.permission#ACCESS_NETWORK_STATE
permission.
context
- the current contextpublic IgnitedHttpRequest get(String url)
public IgnitedHttpRequest get(String url, boolean cached)
public IgnitedHttpRequest post(String url)
public IgnitedHttpRequest post(String url, org.apache.http.HttpEntity payload)
public IgnitedHttpRequest put(String url)
public IgnitedHttpRequest put(String url, org.apache.http.HttpEntity payload)
public IgnitedHttpRequest delete(String url)
public void setMaximumConnections(int maxConnections)
public void setConnectionTimeout(int connectionTimeout)
connectionTimeout
- the timeout in millisecondsCoreConnectionPNames.CONNECTION_TIMEOUT
public void setSocketTimeout(int socketTimeout)
socketTimeout
- the timeout in millisecondsCoreConnectionPNames.SO_TIMEOUT
public void setDefaultHeader(String header, String value)
public HashMap<String,String> getDefaultHeaders()
public void setPortForScheme(String scheme, int port)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |