com.esri.wms.client
Class GenericRequest

java.lang.Object
  extended by com.esri.wms.client.GenericRequest
All Implemented Interfaces:
Serializable

public class GenericRequest
extends Object
implements Serializable

All WMS requests support the HTTP GET method. The requests are basically key/value pairs. The GenericRequest class is a helper class. It uses a java.util.Map object internally handling the request.

See Also:
Serialized Form

Field Summary
protected  Map<String,String> request
          The Map handling the request key/value pairs.
 
Constructor Summary
GenericRequest()
          Instantiates an empty object of GenericRequest.
GenericRequest(Map<String,String> request)
          Instantiates an object of GenericRequest with the given request.
 
Method Summary
 boolean equals(Object obj)
          Compares the specified object with this instance for equality.
 Map<String,String> getRequestParameters()
          Returns the Map object holding all the key/values settings.
 int hashCode()
          Returns the hash code of the request object.
 void put(String key, Boolean value, boolean mandatory)
          Creates a request parameter by the given key value pair.
 void put(String key, Color value, boolean mandatory)
          Creates a request parameter by the given key value pair.
 void put(String key, int value)
          Creates a request parameter by the given key value pair.
 void put(String key, String value, boolean mandatory)
          Creates a request parameter by the given key value pair.
 void setRequestParameters(Map<String,String> request)
          Replaces the request by the given one.
 String toRequestString()
          Creates a request String.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

request

protected Map<String,String> request
The Map handling the request key/value pairs.

Constructor Detail

GenericRequest

public GenericRequest()
Instantiates an empty object of GenericRequest.


GenericRequest

public GenericRequest(Map<String,String> request)
Instantiates an object of GenericRequest with the given request.

Parameters:
request - all existed key value pairs will be inherited.
Method Detail

getRequestParameters

public Map<String,String> getRequestParameters()
Returns the Map object holding all the key/values settings.


put

public void put(String key,
                Boolean value,
                boolean mandatory)
Creates a request parameter by the given key value pair. If the value is null and mandatory == true, the value will be set as "" instead of null. If the value is null and mandatory == false, the key/value will be omitted.

Parameters:
key - the key of the request parameter.
value - the value of the parameter, which can be null.
mandatory - set to true if the parameter is mandatory in the request.

put

public void put(String key,
                Color value,
                boolean mandatory)
Creates a request parameter by the given key value pair. If the value is null and mandatory == true, the value will be set as "" instead of null. If the value is null and mandatory == false, the key/value will be omitted.

Parameters:
key - the key of the request parameter.
value - the value of the parameter, which can be null.
mandatory - set to true if the parameter is mandatory in the request.

put

public void put(String key,
                int value)
Creates a request parameter by the given key value pair. If the value is null and mandatory == true, the value will be set as "" instead of null. If the value is null and mandatory == false, the key/value will be omitted.

Parameters:
key - the key of the request parameter.
value - the value of the parameter.

put

public void put(String key,
                String value,
                boolean mandatory)
Creates a request parameter by the given key value pair. If the value is null and mandatory == true, the value will be set as "" instead of null. If the value is null and mandatory == false, the key/value will be omitted.

Parameters:
key - the key of the request parameter.
value - the value of the parameter, which can be null.
mandatory - set to true if the parameter is mandatory in the request.

setRequestParameters

public void setRequestParameters(Map<String,String> request)
Replaces the request by the given one.

Parameters:
request - a Map to replace current request.

toRequestString

public String toRequestString()
Creates a request String. The request will be k1=v1&k2=v2&.. format. All spaces will be encoded to %20.

Returns:
the request string.

hashCode

public int hashCode()
Returns the hash code of the request object.

Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Compares the specified object with this instance for equality. Returns true if all fields of the two Objects are equal.

Overrides:
equals in class Object
Parameters:
obj - object to be compared for equality with this instance.
Returns:
Returns true if the specified object is equal to this instance.