org.jboss.seam.social.scribe
Class OAuthRequestScribe

java.lang.Object
  extended by org.jboss.seam.social.scribe.OAuthRequestScribe
All Implemented Interfaces:
Serializable, OAuthRequest, RestRequest

public class OAuthRequestScribe
extends Object
implements OAuthRequest

Author:
Antoine Sabot-Durand
See Also:
Serialized Form

Constructor Summary
OAuthRequestScribe(RestVerb verb, String url)
           
 
Method Summary
 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 addPayload(String payload)
          Add body payload.
 void addQuerystringParameter(String key, String value)
          Add a QueryString parameter
 boolean equals(Object obj)
           
 String getBodyContents()
           
 Map<String,String> getBodyParams()
          Obtains a Map of the body parameters.
 Map<String,String> getHeaders()
          Returns the connection headers as a Map
 Map<String,String> getOauthParameters()
          Returns the Map containing the key-value pair of parameters.
 Map<String,String> getQueryStringParams()
          Get a Map of the query string parameters.
 String getSanitizedUrl()
          Returns the URL without the port and the query string part.
 String getUrl()
          Obtains the URL of the HTTP Request.
 RestVerb getVerb()
           
 int hashCode()
           
 RestResponse send()
          Execute the request and return a HttpResonse
 void setConnectTimeout(int duration, TimeUnit unit)
          Sets the connect timeout for the underlying HttpURLConnection
 void setReadTimeout(int duration, TimeUnit unit)
          Sets the read timeout for the underlying HttpURLConnection
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

OAuthRequestScribe

public OAuthRequestScribe(RestVerb verb,
                          String url)
Parameters:
verb -
uri -
Method Detail

addOAuthParameter

public void addOAuthParameter(String key,
                              String value)
Description copied from interface: OAuthRequest
Adds an OAuth parameter.

Specified by:
addOAuthParameter in interface OAuthRequest
value - value of the parameter

send

public RestResponse send()
Description copied from interface: RestRequest
Execute the request and return a HttpResonse

Specified by:
send in interface RestRequest
Returns:
Rest Response

getOauthParameters

public Map<String,String> getOauthParameters()
Description copied from interface: OAuthRequest
Returns the Map containing the key-value pair of parameters.

Specified by:
getOauthParameters in interface OAuthRequest
Returns:
parameters as map

toString

public String toString()
Overrides:
toString in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

addHeader

public void addHeader(String key,
                      String value)
Description copied from interface: RestRequest
Add an HTTP Header to the Request

Specified by:
addHeader in interface RestRequest
Parameters:
key - the header name
value - the header value

addBodyParameter

public void addBodyParameter(String key,
                             String value)
Description copied from interface: RestRequest
Add a body Parameter (for POST/ PUT Requests)

Specified by:
addBodyParameter in interface RestRequest
Parameters:
key - the parameter name
value - the parameter value

addQuerystringParameter

public void addQuerystringParameter(String key,
                                    String value)
Description copied from interface: RestRequest
Add a QueryString parameter

Specified by:
addQuerystringParameter in interface RestRequest
Parameters:
key - the parameter name
value - the parameter value

addPayload

public void addPayload(String payload)
Description copied from interface: RestRequest
Add body payload. This method is used when the HTTP body is not a form-url-encoded string, but another thing. Like for example XML.

Specified by:
addPayload in interface RestRequest
Parameters:
payload - the body of the request

getQueryStringParams

public Map<String,String> getQueryStringParams()
Description copied from interface: RestRequest
Get a Map of the query string parameters.

Specified by:
getQueryStringParams in interface RestRequest
Returns:
a map containing the query string parameters

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

getBodyParams

public Map<String,String> getBodyParams()
Description copied from interface: RestRequest
Obtains a Map of the body parameters.

Specified by:
getBodyParams in interface RestRequest
Returns:
a map containing the body parameters.

getUrl

public String getUrl()
Description copied from interface: RestRequest
Obtains the URL of the HTTP Request.

Specified by:
getUrl in interface RestRequest
Returns:
the original URL of the HTTP Request

getSanitizedUrl

public String getSanitizedUrl()
Description copied from interface: RestRequest
Returns the URL without the port and the query string part.

Specified by:
getSanitizedUrl in interface RestRequest
Returns:
the sanitized URL

getBodyContents

public String getBodyContents()
Specified by:
getBodyContents in interface RestRequest
Returns:
the Body of the request

getVerb

public RestVerb getVerb()
Specified by:
getVerb in interface RestRequest
Returns:
the REST verb

getHeaders

public Map<String,String> getHeaders()
Description copied from interface: RestRequest
Returns the connection headers as a Map

Specified by:
getHeaders in interface RestRequest
Returns:
map of headers

setConnectTimeout

public void setConnectTimeout(int duration,
                              TimeUnit unit)
Description copied from interface: RestRequest
Sets the connect timeout for the underlying HttpURLConnection

Specified by:
setConnectTimeout in interface RestRequest
Parameters:
duration - duration of the timeout
unit - unit of time (milliseconds, seconds, etc)

setReadTimeout

public void setReadTimeout(int duration,
                           TimeUnit unit)
Description copied from interface: RestRequest
Sets the read timeout for the underlying HttpURLConnection

Specified by:
setReadTimeout in interface RestRequest
Parameters:
duration - duration of the timeout
unit - unit of time (milliseconds, seconds, etc)


Copyright © 2011 Seam Framework. All Rights Reserved.