org.milyn.useragent.request
Class MockHttpRequest

java.lang.Object
  extended by org.milyn.useragent.request.MockHttpRequest
All Implemented Interfaces:
HttpRequest, Request

public class MockHttpRequest
extends Object
implements HttpRequest

Mock object for a Http request.

Author:
Tom Fennelly

Constructor Summary
MockHttpRequest()
           
 
Method Summary
 String getHeader(String name)
          Get the named HTTP request header.
 String getParameter(String name)
          Get the named HTTP request parameter from the request query string.
 Enumeration getParameterNames()
          Returns an Enumeration of String objects containing the names of the parameters contained in this request.
 String[] getParameterValues(String name)
          Returns an array of String objects containing all of the values the given request parameter has, or null if the parameter does not exist.
 void reset()
           
 void setHeader(String header, String value)
           
 void setParameter(String parameter, String value)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MockHttpRequest

public MockHttpRequest()
Method Detail

setHeader

public void setHeader(String header,
                      String value)

setParameter

public void setParameter(String parameter,
                         String value)

getHeader

public String getHeader(String name)
Description copied from interface: HttpRequest
Get the named HTTP request header.

Specified by:
getHeader in interface HttpRequest
Parameters:
name - The request header name.
Returns:
The value of the header with the specified name, or null if the header isn't present in the request.

getParameter

public String getParameter(String name)
Description copied from interface: HttpRequest
Get the named HTTP request parameter from the request query string.

Specified by:
getParameter in interface HttpRequest
Parameters:
name - The name of the required request parameter.
Returns:
The value of the request parameter, or null if the parameter isn't present in the request.

getParameterNames

public Enumeration getParameterNames()
Description copied from interface: HttpRequest
Returns an Enumeration of String objects containing the names of the parameters contained in this request. If the request has no parameters, the method returns an empty Enumeration.

Specified by:
getParameterNames in interface HttpRequest
Returns:
an Enumeration of String objects, each String containing the name of a request parameter; or an empty Enumeration if the request has no parameters.

getParameterValues

public String[] getParameterValues(String name)
Description copied from interface: HttpRequest
Returns an array of String objects containing all of the values the given request parameter has, or null if the parameter does not exist.

If the parameter has a single value, the array has a length of 1.

Specified by:
getParameterValues in interface HttpRequest
Parameters:
name - String containing the name of the parameter whose value is requested.
Returns:
an array of String objects containing the parameter's values.

reset

public void reset()


Copyright © 2018. All rights reserved.