public abstract class AbstractRequest extends Object
| Modifier and Type | Field and Description |
|---|---|
protected static String |
CONTENT_LENGTH |
static String |
CONTENT_TYPE |
static String |
DEFAULT_CONTENT_TYPE |
| Constructor and Description |
|---|
AbstractRequest(Verb verb,
String url)
Default constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addBodyParameter(String key,
String value)
Add a body Parameter (for POST/ PUT Requests)
|
void |
addHeader(String key,
String value)
Add an HTTP Header to the Request
|
void |
addOAuthParameter(String key,
String value)
Adds an OAuth parameter.
|
void |
addParameter(String key,
String value) |
void |
addQuerystringParameter(String key,
String value)
Add a QueryString parameter
|
ParameterList |
getBodyParams()
Obtains a
ParameterList of the body parameters. |
byte[] |
getByteArrayPayload() |
String |
getCharset() |
String |
getCompleteUrl()
Returns the complete url (host + resource + encoded querystring parameters).
|
File |
getFilePayload() |
Map<String,String> |
getHeaders() |
Map<String,String> |
getOauthParameters() |
ParameterList |
getQueryStringParams()
Get a
ParameterList with the query string parameters. |
String |
getRealm() |
String |
getSanitizedUrl()
Returns the URL without the port and the query string part.
|
String |
getStringPayload()
Returns the body of the request (set in
setPayload(java.lang.String)) |
String |
getUrl()
Obtains the URL of the HTTP Request.
|
Verb |
getVerb() |
protected boolean |
hasBodyContent() |
boolean |
isFollowRedirects() |
void |
setCharset(String charsetName)
Set the charset of the body of the request
|
void |
setFollowRedirects(boolean followRedirects)
Sets whether the underlying Http Connection follows redirects or not.
|
void |
setPayload(byte[] payload)
Overloaded version for byte arrays
|
void |
setPayload(File payload)
Overloaded version for File
|
void |
setPayload(String payload)
Set body payload.
|
void |
setRealm(String realm) |
String |
toString() |
public static final String DEFAULT_CONTENT_TYPE
public static final String CONTENT_TYPE
protected static final String CONTENT_LENGTH
public void addOAuthParameter(String key, String value)
key - name of the parametervalue - value of the parameterIllegalArgumentException - if the parameter is not an OAuth parameterpublic void setRealm(String realm)
public String getRealm()
public String getCompleteUrl()
public void addHeader(String key, String value)
key - the header namevalue - the header valuepublic void addBodyParameter(String key, String value)
key - the parameter namevalue - the parameter valuepublic void addQuerystringParameter(String key, String value)
key - the parameter namevalue - the parameter valueprotected boolean hasBodyContent()
public void setPayload(String payload)
payload - the body of the requestpublic void setPayload(byte[] payload)
payload - byte[]public void setPayload(File payload)
payload - Filepublic ParameterList getQueryStringParams()
ParameterList with the query string parameters.ParameterList containing the query string parameters.OAuthException - if the request URL is not valid.public ParameterList getBodyParams()
ParameterList of the body parameters.ParameterListcontaining the body parameters.public String getUrl()
public String getSanitizedUrl()
public String getStringPayload()
setPayload(java.lang.String))OAuthException - if the charset chosen is not supportedpublic byte[] getByteArrayPayload()
setPayload(byte[]) or in
addBodyParameter(java.lang.String, java.lang.String) )public File getFilePayload()
public Verb getVerb()
public String getCharset()
public void setCharset(String charsetName)
charsetName - name of the charset of the requestpublic void setFollowRedirects(boolean followRedirects)
followRedirects - booleanpublic boolean isFollowRedirects()
Copyright © 2016. All rights reserved.