public class HttpRequestOptions
extends java.lang.Object
HttpCache
Modifier and Type | Field and Description |
---|---|
private boolean |
_allowCircularRedirects |
private long |
_cacheTTLSeconds
If set to a positive value, then new HTTP request will be placed if
the cache is older than that positive value (in seconds)
This applies to the internal HttpCache, not the HTTP protocol
cache-control mechanisms.
|
private int |
_connTimeout
HTTP connect timeout, in milliseconds.
|
private java.lang.String |
_contentType
If HttpRequestOptions' content type matches a cached HttpResponse's
content type, the cache copy is returned; otherwise a new HTTP request
is placed.
|
private int |
_maxBodySize
Maximum size in bytes to be retrieved for the response body.
|
private int |
_maxRedirects
Maximum number of redirects to be followed for the HTTP calls.
|
private java.util.Map |
_requestHeaders
Map with HTTP request headers to be used when placing the HTTP request.
|
private int |
_socketTimeout
HTTP socket (read) timeout, in milliseconds.
|
private boolean |
_useCache
If set to false, a new HTTP request will be placed even if a cached copy
exists.
|
Constructor and Description |
---|
HttpRequestOptions()
Constructs a set of HTTP request options with the default values.
|
HttpRequestOptions(HttpRequestOptions other)
Creates a new HttpRequestOptions object as a clone of the provided
parameter.
|
Modifier and Type | Method and Description |
---|---|
void |
addRequestHeader(java.lang.String headerName,
java.lang.String headerValue)
Adds a new HTTP request header.
|
boolean |
getAllowCircularRedirects() |
long |
getCacheTTLSeconds()
Gets the TTL for the cached response in seconds
|
int |
getConnTimeout()
Gets the HTTP connect timeout, in milliseconds.
|
java.lang.String |
getContentType()
Gets the required content-type for the HTTP response.
|
static HttpRequestOptions |
getDefaultOptionsForDiscovery()
Returns an
HttpRequestOptions object suitable to use for
HTTP requests to perform discovery. |
static HttpRequestOptions |
getDefaultOptionsForOpCalls()
Returns an
HttpRequestOptions object suitable to use for
HTTP requests to OP endpoints for the purpose of creating associations
or verifying signatures. |
int |
getMaxBodySize()
Gets configuration parameter for the maximum HTTP body size
that will be downloaded.
|
int |
getMaxRedirects()
Gets the internal limit configured for the maximum number of redirects
to be followed for the HTTP calls.
|
java.util.Map |
getRequestHeaders()
Gets the HTTP request headers that will be used when placing
HTTP requests using the options in this object.
|
int |
getSocketTimeout()
Gets the HTTP socket (read) timeout, in milliseconds.
|
boolean |
isUseCache()
Returns true if a cached copy can be used when placing HTTP requests
using the options in this object.
|
void |
setAllowCircularRedirects(boolean allow) |
void |
setCacheTTLSeconds(long ttl)
Sets the TTL for the cached response in seconds
|
void |
setConnTimeout(int connTimeout)
Sets the HTTP connect timeout, in milliseconds.
|
void |
setContentType(java.lang.String contentType)
Sets the required content-type for the HTTP response.
|
void |
setMaxBodySize(int maxBodySize)
Sets the maximum HTTP body size that will be downloaded.
|
void |
setMaxRedirects(int maxRedirects)
Sets the maximum number of redirects to be followed for the HTTP calls.
|
void |
setRequestHeaders(java.util.Map requestHeaders)
Sets the HTTP request headers that will be used when placing
HTTP requests using the options in this object.
|
void |
setSocketTimeout(int socketTimeout)
Sets HTTP socket (read) timeout, in milliseconds.
|
void |
setUseCache(boolean useCache)
Sets the flag for allowing cached copy to be used when placing
HTTP requests using the options in this object.
|
private int _connTimeout
private int _socketTimeout
private int _maxRedirects
private int _maxBodySize
private java.util.Map _requestHeaders
private boolean _useCache
HttpCache
private boolean _allowCircularRedirects
private java.lang.String _contentType
private long _cacheTTLSeconds
HttpCache
public HttpRequestOptions()
public HttpRequestOptions(HttpRequestOptions other)
other
- HttpRequestOptions instance to be cloned.public static HttpRequestOptions getDefaultOptionsForDiscovery()
HttpRequestOptions
object suitable to use for
HTTP requests to perform discovery.public static HttpRequestOptions getDefaultOptionsForOpCalls()
HttpRequestOptions
object suitable to use for
HTTP requests to OP endpoints for the purpose of creating associations
or verifying signatures.public int getConnTimeout()
public void setConnTimeout(int connTimeout)
public int getSocketTimeout()
public void setSocketTimeout(int socketTimeout)
public int getMaxRedirects()
public void setMaxRedirects(int maxRedirects)
public int getMaxBodySize()
public void setMaxBodySize(int maxBodySize)
public java.util.Map getRequestHeaders()
public void setRequestHeaders(java.util.Map requestHeaders)
public void addRequestHeader(java.lang.String headerName, java.lang.String headerValue)
public boolean isUseCache()
public void setUseCache(boolean useCache)
public java.lang.String getContentType()
public void setContentType(java.lang.String contentType)
public boolean getAllowCircularRedirects()
public void setAllowCircularRedirects(boolean allow)
public long getCacheTTLSeconds()
public void setCacheTTLSeconds(long ttl)
Copyright 2006-2008 Sxip Identity Corporation