public abstract class AbstractRequest extends Object
| Modifier and Type | Field and Description |
|---|---|
protected static String |
CONTENT_LENGTH |
protected static String |
CONTENT_TYPE |
static String |
DEFAULT_CONTENT_TYPE |
| Constructor and Description |
|---|
AbstractRequest(Verb verb,
String url,
OAuthService service)
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 |
addPayload(byte[] payload)
Overloaded version for byte arrays
|
void |
addPayload(String payload)
Add body payload.
|
void |
addQuerystringParameter(String key,
String value)
Add a QueryString parameter
|
String |
getBodyContents()
Returns the body of the request
|
ParameterList |
getBodyParams()
Obtains a
ParameterList of the body parameters. |
String |
getCharset() |
String |
getCompleteUrl()
Returns the complete url (host + resource + encoded querystring parameters).
|
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.
|
OAuthService |
getService() |
String |
getUrl()
Obtains the URL of the HTTP Request.
|
Verb |
getVerb() |
protected boolean |
hasBodyContent() |
boolean |
isConnectionKeepAlive() |
boolean |
isFollowRedirects() |
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 |
setFollowRedirects(boolean followRedirects)
Sets whether the underlying Http Connection follows redirects or not.
|
void |
setRealm(String realm) |
String |
toString() |
public static final String DEFAULT_CONTENT_TYPE
protected static final String CONTENT_LENGTH
protected static final String CONTENT_TYPE
public AbstractRequest(Verb verb, String url, OAuthService service)
verb - Http verb/methodurl - resource URLservice - OAuthServicepublic 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 addPayload(String payload)
payload - the body of the requestpublic void addPayload(byte[] payload)
payload - byte[]public 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 getBodyContents()
OAuthException - if the charset chosen is not supportedpublic Verb getVerb()
public String getCharset()
public void setCharset(String charsetName)
charsetName - name of the charset of the requestpublic void setConnectionKeepAlive(boolean connectionKeepAlive)
connectionKeepAlive - booleanpublic void setFollowRedirects(boolean followRedirects)
followRedirects - booleanpublic boolean isConnectionKeepAlive()
public boolean isFollowRedirects()
public OAuthService getService()
Copyright © 2016. All rights reserved.