public interface Request
| Modifier and Type | Method and Description |
|---|---|
void |
addBodyParameter(String key,
String value)
Add a body Parameter (for POST/ PUT Requests)
|
void |
addBodyParameters(Map<String,? extends Object> params)
Add Body parameters from a map
|
void |
addHeader(String key,
String value)
Add an HTTP HEADER to the Request
|
void |
addPayload(byte[] payload)
Add body payload from an Array of bytes
|
void |
addPayload(String payload)
Add body payload from a String
|
void |
addQuerystringParameter(String key,
String value)
Add a QueryString parameter
|
String |
getBodyContents()
Returns the body of the request
|
HttpParameters |
getBodyParams()
Obtains a
HttpParameters of the body parameters. |
String |
getCharset()
Returns the connection charset.
|
String |
getCompleteUrl()
Returns the complete url (host + resource + encoded querystring parameters).
|
Map<String,String> |
getHeaders()
Returns the connection headers as a
Map |
HttpParameters |
getQueryStringParams()
Get a
HttpParameters with the query string parameters. |
String |
getSanitizedUrl()
Returns the URL without the port and the query string part.
|
String |
getUrl()
Obtains the URL of the HTTP Request.
|
Verb |
getVerb()
Returns the HTTP Verb
|
Response |
send()
Execute the request and return a
Response |
Response |
send(RequestTuner tuner)
Execute the request and return a
Response |
void |
setCharset(String charsetName)
Set the charset of the body of the request
|
void |
setConnectionKeepAlive(boolean connectionKeepAlive)
Sets whether the underlying Http Connection is persistent or not.
|
void |
setConnectTimeout(int duration,
TimeUnit unit)
Sets the connect timeout for the underlying
HttpURLConnection |
void |
setReadTimeout(int duration,
TimeUnit unit)
Sets the read timeout for the underlying
HttpURLConnection |
Response send(RequestTuner tuner)
Responsetuner - a tuner to alter request behaviorRuntimeException - if the connection cannot be created.Response send()
ResponseString getCompleteUrl()
void addHeader(String key, String value)
key - the header namevalue - the header valuevoid addBodyParameter(String key, String value)
key - the parameter namevalue - the parameter valuevoid addQuerystringParameter(String key, String value)
key - the parameter namevalue - the parameter valuevoid addPayload(String payload)
payload - the payload to add to bodyvoid addPayload(byte[] payload)
payload - the payload to add to bodyHttpParameters getQueryStringParams()
HttpParameters with the query string parameters.AgoravaException - if the request URL is not valid.HttpParameters getBodyParams()
HttpParameters of the body parameters.String getUrl()
String getSanitizedUrl()
String getBodyContents()
AgoravaException - if the charset chosen is not supportedVerb getVerb()
Map<String,String> getHeaders()
MapString getCharset()
Charset defaultCharset if not setvoid setCharset(String charsetName)
charsetName - name of the charset of the requestvoid setConnectTimeout(int duration,
TimeUnit unit)
HttpURLConnectionduration - duration of the timeoutunit - unit of time (milliseconds, seconds, etc)void setReadTimeout(int duration,
TimeUnit unit)
HttpURLConnectionduration - duration of the timeoutunit - unit of time (milliseconds, seconds, etc)void setConnectionKeepAlive(boolean connectionKeepAlive)
connectionKeepAlive - if true the connection is persistentCopyright © 2012-2013. All Rights Reserved.