Package com.github.scribejava.core.model
Class OAuthRequest
java.lang.Object
com.github.scribejava.core.model.OAuthRequest
The representation of an OAuth HttpRequest.
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddBodyParameter(String key, String value) Add a body Parameter (for POST/ PUT Requests)voidaddBodyPartPayloadInMultipartPayload(BodyPartPayload bodyPartPayload) voidAdd an HTTP Header to the RequestvoidaddOAuthParameter(String key, String value) Adds an OAuth parameter.voidaddParameter(String key, String value) voidaddQuerystringParameter(String key, String value) Add a QueryString parameterObtains aParameterListof the body parameters.byte[]Returns the complete url (host + resource + encoded querystring parameters).Get aParameterListwith the query string parameters.getRealm()Returns the URL without the port and the query string part.Returns the body of the request (set insetPayload(java.lang.String))getUrl()Obtains the URL of the HTTP Request.getVerb()voidvoidinitMultipartPayload(String boundary) voidinitMultipartPayload(String subtype, String boundary) voidvoidinitMultipartPayload(String boundary, Map<String, String> headers) voidinitMultipartPayload(Map<String, String> headers) voidsetBodyPartPayloadInMultipartPayload(BodyPartPayload bodyPartPayload) voidsetCharset(String charsetName) Set the charset of the body of the requestvoidsetMultipartPayload(MultipartPayload multipartPayload) voidsetPayload(byte[] payload) Overloaded version for byte arraysvoidsetPayload(File payload) Overloaded version for FilevoidsetPayload(String payload) Set body payload.voidtoString()
-
Constructor Details
-
OAuthRequest
Default constructor.- Parameters:
verb- Http verb/methodurl- resource URL
-
-
Method Details
-
addOAuthParameter
Adds an OAuth parameter.- Parameters:
key- name of the parametervalue- value of the parameter- Throws:
IllegalArgumentException- if the parameter is not an OAuth parameter
-
getOauthParameters
-
setRealm
-
getRealm
-
getCompleteUrl
Returns the complete url (host + resource + encoded querystring parameters).- Returns:
- the complete url.
-
addHeader
Add an HTTP Header to the Request- Parameters:
key- the header namevalue- the header value
-
addBodyParameter
Add a body Parameter (for POST/ PUT Requests)- Parameters:
key- the parameter namevalue- the parameter value
-
addQuerystringParameter
Add a QueryString parameter- Parameters:
key- the parameter namevalue- the parameter value
-
addParameter
-
getMultipartPayload
-
setMultipartPayload
-
initMultipartPayload
public void initMultipartPayload() -
initMultipartPayload
-
initMultipartPayload
-
initMultipartPayload
-
initMultipartPayload
-
initMultipartPayload
-
setBodyPartPayloadInMultipartPayload
-
addBodyPartPayloadInMultipartPayload
-
setPayload
Set body payload. This method is used when the HTTP body is not a form-url-encoded string, but another thing. Like for example XML. Note: The contents are not part of the OAuth signature- Parameters:
payload- the body of the request
-
setPayload
public void setPayload(byte[] payload) Overloaded version for byte arrays- Parameters:
payload- byte[]
-
setPayload
Overloaded version for File- Parameters:
payload- File
-
getQueryStringParams
Get aParameterListwith the query string parameters.- Returns:
- a
ParameterListcontaining the query string parameters. - Throws:
OAuthException- if the request URL is not valid.
-
getBodyParams
Obtains aParameterListof the body parameters.- Returns:
- a
ParameterListcontaining the body parameters.
-
getUrl
Obtains the URL of the HTTP Request.- Returns:
- the original URL of the HTTP Request
-
getSanitizedUrl
Returns the URL without the port and the query string part.- Returns:
- the OAuth-sanitized URL
-
getStringPayload
Returns the body of the request (set insetPayload(java.lang.String))- Returns:
- form encoded string
-
getByteArrayPayload
public byte[] getByteArrayPayload()- Returns:
- the body of the request (set in
setPayload(byte[])or inaddBodyParameter(java.lang.String, java.lang.String))
-
getFilePayload
-
toString
-
getVerb
-
getHeaders
-
getCharset
-
setCharset
Set the charset of the body of the request- Parameters:
charsetName- name of the charset of the request
-