public class OAuthRequest extends AbstractRequest
Modifier and Type | Class and Description |
---|---|
static interface |
OAuthRequest.ResponseConverter<T> |
Constructor and Description |
---|
OAuthRequest(Verb verb,
String url)
Default constructor.
|
OAuthRequest(Verb verb,
String url,
OAuthConfig config)
|
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() |
void |
setCharset(String charsetName)
Set the charset of the body of the request
|
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 OAuthRequest(Verb verb, String url)
verb
- Http verb/methodurl
- resource URL@Deprecated public OAuthRequest(Verb verb, String url, OAuthConfig config)
verb
- verburl
- urlconfig
- unusedpublic 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.ParameterList
containing the body parameters.public String getUrl()
public String getSanitizedUrl()
public String getStringPayload()
setPayload(java.lang.String)
)public 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 requestCopyright © 2017. All rights reserved.