public class OAuthRequest extends Object
Modifier and Type | Class and Description |
---|---|
static interface |
OAuthRequest.ResponseConverter<T> |
Constructor and Description |
---|
OAuthRequest(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 |
addMultipartPayload(String contentDisposition,
String contentType,
byte[] payload)
you can invoke
initMultipartBoundary(java.lang.String) to set custom boundary |
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() |
MultipartPayload |
getMultipartPayloads() |
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() |
void |
initMultipartBoundary()
init boundary of multipart request with default boundary
|
void |
initMultipartBoundary(String boundary)
Set boundary of multipart request
|
void |
setCharset(String charsetName)
Set the charset of the body of the request
|
void |
setMultipartPayload(String contentDisposition,
String contentType,
byte[] payload) |
void |
setMultipartPayload(String boundary,
String contentDisposition,
String contentType,
byte[] payload) |
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 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 valuepublic void initMultipartBoundary(String boundary)
boundary
- can be any stringpublic void initMultipartBoundary()
public void addMultipartPayload(String contentDisposition, String contentType, byte[] payload)
initMultipartBoundary(java.lang.String)
to set custom boundarypublic void setMultipartPayload(String contentDisposition, String contentType, byte[] payload)
public void setMultipartPayload(String boundary, String contentDisposition, String contentType, byte[] payload)
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 MultipartPayload getMultipartPayloads()
public File getFilePayload()
public Verb getVerb()
public String getCharset()
public void setCharset(String charsetName)
charsetName
- name of the charset of the requestCopyright © 2018. All rights reserved.