public abstract class AbstractRequest extends Object
Modifier and Type | Field and Description |
---|---|
protected static String |
CONTENT_LENGTH |
static String |
CONTENT_TYPE |
static String |
DEFAULT_CONTENT_TYPE |
Constructor and Description |
---|
AbstractRequest(Verb verb,
String url)
Default constructor.
|
AbstractRequest(Verb verb,
String url,
OAuthService<?> service)
|
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)
Deprecated.
|
void |
addPayload(String payload)
Deprecated.
|
void |
addQuerystringParameter(String key,
String value)
Add a QueryString parameter
|
String |
getBodyContents()
Deprecated.
|
ParameterList |
getBodyParams()
Obtains a
ParameterList of the body parameters. |
byte[] |
getByteArrayPayload() |
byte[] |
getByteBodyContents()
Deprecated.
|
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.
|
OAuthService<?> |
getService()
Deprecated.
Request doesn't couple with Service anymore. It doesn't need it. Look for service somewhere else
|
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() |
boolean |
isFollowRedirects() |
void |
setCharset(String charsetName)
Set the charset of the body of the request
|
void |
setFollowRedirects(boolean followRedirects)
Sets whether the underlying Http Connection follows redirects or not.
|
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 static final String DEFAULT_CONTENT_TYPE
public static final String CONTENT_TYPE
protected static final String CONTENT_LENGTH
@Deprecated 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()
@Deprecated public void addPayload(String payload)
setPayload(java.lang.String)
payload
- payload@Deprecated public void addPayload(byte[] payload)
setPayload(byte[])
payload
- payloadpublic 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()
@Deprecated public String getBodyContents()
getStringPayload()
or getByteArrayPayload()
setPayload(java.lang.String)
public String getStringPayload()
setPayload(java.lang.String)
)OAuthException
- if the charset chosen is not supported@Deprecated public byte[] getByteBodyContents()
getByteArrayPayload()
setPayload(byte[])
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 requestpublic void setFollowRedirects(boolean followRedirects)
followRedirects
- booleanpublic boolean isFollowRedirects()
@Deprecated public OAuthService<?> getService()
Copyright © 2016. All rights reserved.