org.jboss.seam.social.core
Interface OAuthRequest


public interface OAuthRequest

Implementation of this interface Represent an OAuth Request

Author:
Antoine Sabot-Durand

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 name, String value)
          Adds an OAuth parameter.
 void addPayload(String payload)
          Add body payload.
 void addQuerystringParameter(String key, String value)
          Add a QueryString parameter
 String getBodyContents()
          Returns the URL without the port and the query string part.
 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()
          Returns the HTTP Verb
 HttpResponse 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
 

Method Detail

addOAuthParameter

void addOAuthParameter(String name,
                       String value)
Adds an OAuth parameter.

Parameters:
key - name of the parameter
value - value of the parameter

send

HttpResponse send()
Execute the request and return a HttpResonse

Returns:
Http Response

getOauthParameters

Map<String,String> getOauthParameters()
Returns the Map containing the key-value pair of parameters.

Returns:
parameters as map

addHeader

void addHeader(String key,
               String value)
Add an HTTP Header to the Request

Parameters:
key - the header name
value - the header value

addBodyParameter

void addBodyParameter(String key,
                      String value)
Add a body Parameter (for POST/ PUT Requests)

Parameters:
key - the parameter name
value - the parameter value

addQuerystringParameter

void addQuerystringParameter(String key,
                             String value)
Add a QueryString parameter

Parameters:
key - the parameter name
value - the parameter value

addPayload

void addPayload(String payload)
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. Note: The contents are not part of the OAuth signature

Parameters:
payload - the body of the request

getQueryStringParams

Map<String,String> getQueryStringParams()
Get a Map of the query string parameters.

Returns:
a map containing the query string parameters
Throws:
OAuthException - if the URL is not valid

getBodyParams

Map<String,String> getBodyParams()
Obtains a Map of the body parameters.

Returns:
a map containing the body parameters.

getUrl

String getUrl()
Obtains the URL of the HTTP Request.

Returns:
the original URL of the HTTP Request

getSanitizedUrl

String getSanitizedUrl()
Returns the URL without the port and the query string part.

Returns:
the OAuth-sanitized URL

getBodyContents

String getBodyContents()
Returns the URL without the port and the query string part.

Returns:
the OAuth-sanitized URL

getVerb

RestVerb getVerb()
Returns the HTTP Verb

Returns:
the verb

getHeaders

Map<String,String> getHeaders()
Returns the connection headers as a Map

Returns:
map of headers

setConnectTimeout

void setConnectTimeout(int duration,
                       TimeUnit unit)
Sets the connect timeout for the underlying HttpURLConnection

Parameters:
duration - duration of the timeout
unit - unit of time (milliseconds, seconds, etc)

setReadTimeout

void setReadTimeout(int duration,
                    TimeUnit unit)
Sets the read timeout for the underlying HttpURLConnection

Parameters:
duration - duration of the timeout
unit - unit of time (milliseconds, seconds, etc)


Copyright © 2011 Seam Framework. All Rights Reserved.