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 TypeMethodDescriptionvoid
addBodyParameter
(String key, String value) Add a body Parameter (for POST/ PUT Requests)void
addBodyPartPayloadInMultipartPayload
(BodyPartPayload bodyPartPayload) void
Add an HTTP Header to the Requestvoid
addOAuthParameter
(String key, String value) Adds an OAuth parameter.void
addParameter
(String key, String value) void
addQuerystringParameter
(String key, String value) Add a QueryString parameterObtains aParameterList
of the body parameters.byte[]
Returns the complete url (host + resource + encoded querystring parameters).Get aParameterList
with 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()
void
void
initMultipartPayload
(String boundary) void
initMultipartPayload
(String subtype, String boundary) void
void
initMultipartPayload
(String boundary, Map<String, String> headers) void
initMultipartPayload
(Map<String, String> headers) void
setBodyPartPayloadInMultipartPayload
(BodyPartPayload bodyPartPayload) void
setCharset
(String charsetName) Set the charset of the body of the requestvoid
setMultipartPayload
(MultipartPayload multipartPayload) void
setPayload
(byte[] payload) Overloaded version for byte arraysvoid
setPayload
(File payload) Overloaded version for Filevoid
setPayload
(String payload) Set body payload.void
toString()
-
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 aParameterList
with the query string parameters.- Returns:
- a
ParameterList
containing the query string parameters. - Throws:
OAuthException
- if the request URL is not valid.
-
getBodyParams
Obtains aParameterList
of the body parameters.- Returns:
- a
ParameterList
containing 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
-