com.yahoo.rest
Class RestRequest

java.lang.Object
  extended by com.yahoo.rest.RestRequest
Direct Known Subclasses:
ContentAnalysisRequest, ContextSearchRequest, ImageSearchRequest, LocalSearchRequest, MapSearchRequest, NewsSearchRequest, RelatedSuggestionRequest, SpellingSuggestionRequest, VideoSearchRequest, WebSearchRequest

public class RestRequest
extends Object

REST request base class.

Author:
Ryan Kennedy

Constructor Summary
RestRequest(String defaultRequestUrl)
          Constructs a REST request with the given URL.
 
Method Summary
 void addParameter(String name, String value)
          Adds a parameter value to a list.
 void clearParameter(String name)
          Removes a parameter from the list.
 Map getParameters()
          Gets the list of parameters to send to the REST service.
 String getRequestUrl()
          Gets the request URL for the REST request.
 void setParameter(String name, String value)
          Sets a parameter within the request.
 void setRequestUrl(String requestUrl)
          Sets the URL for the REST request, overriding the default set in the constructor.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RestRequest

public RestRequest(String defaultRequestUrl)
Constructs a REST request with the given URL.

Parameters:
defaultRequestUrl - The URL of the REST service.
Method Detail

getParameters

public Map getParameters()
Gets the list of parameters to send to the REST service.

Returns:
The list of parameters to send to the REST service.

setParameter

public void setParameter(String name,
                         String value)
Sets a parameter within the request. Overwrites any preexisting value.

Parameters:
name - The name of the parameter to set.
value - The value of the parameter to set.

addParameter

public void addParameter(String name,
                         String value)
Adds a parameter value to a list.

Parameters:
name - The name of the parameter list to add to.
value - The value to add to the parameter list.

clearParameter

public void clearParameter(String name)
Removes a parameter from the list.

Parameters:
name - The name of the parameter to remove from the list.

getRequestUrl

public String getRequestUrl()
Gets the request URL for the REST request.

Returns:
The request URL for the REST request.

setRequestUrl

public void setRequestUrl(String requestUrl)
Sets the URL for the REST request, overriding the default set in the constructor.

Parameters:
requestUrl - The new URL for the REST request.