velosurf.web
Class HttpQueryTool

java.lang.Object
  extended by org.apache.velocity.tools.generic.ValueParser
      extended by org.apache.velocity.tools.view.tools.ParameterParser
          extended by velosurf.web.HttpQueryTool
All Implemented Interfaces:
java.util.Map

public class HttpQueryTool
extends org.apache.velocity.tools.view.tools.ParameterParser
implements java.util.Map

This class extends the tool org.apache.velocity.tools.view.tools.ParameterParser, adding a generic setter. Values that are set manually hide any previous values that are present in the query under the same key. It is meant for the query scope.

Author:
Claude Brisson

Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
java.util.Map.Entry<K,V>
 
Field Summary
private  org.apache.velocity.tools.view.context.ViewContext context
          view context.
private  java.util.Map extraValues
          extra values map.
 
Constructor Summary
HttpQueryTool()
          Constructor.
 
Method Summary
 void clear()
          Clear extra parameters.
 boolean containsKey(java.lang.Object key)
          Check for the presence of a parameter.
 boolean containsValue(java.lang.Object value)
          Check for the presence of a value.
 java.util.Set<java.util.Map.Entry> entrySet()
           
 java.lang.Object get(java.lang.Object key)
          Generic getter.
 void init(java.lang.Object viewContext)
          Initialize this tool.
 boolean isEmpty()
          Check for the presence of parameters.
 java.util.Set keySet()
          Get the set of parameter names.
 java.lang.Object put(java.lang.Object key, java.lang.Object value)
          Generic setter.
 void putAll(java.util.Map map)
          Put all key/values from a map.
 java.lang.Object remove(java.lang.Object key)
          Remove a parameter (from extra values).
 int size()
          Get the number of parameters.
 java.util.Collection values()
          Get the collection of values
 
Methods inherited from class org.apache.velocity.tools.view.tools.ParameterParser
getRequest, getSource, getString, getStrings, setRequest, setSource
 
Methods inherited from class org.apache.velocity.tools.generic.ValueParser
exists, get, getBoolean, getBoolean, getBoolean, getBooleans, getDouble, getDouble, getDouble, getDoubles, getInt, getInteger, getInteger, getInts, getNumber, getNumber, getNumbers, getString, parseBoolean, parseNumber
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Field Detail

context

private org.apache.velocity.tools.view.context.ViewContext context
view context.


extraValues

private java.util.Map extraValues
extra values map.

Constructor Detail

HttpQueryTool

public HttpQueryTool()
Constructor.

Method Detail

init

public void init(java.lang.Object viewContext)
Initialize this tool.

Overrides:
init in class org.apache.velocity.tools.view.tools.ParameterParser
Parameters:
viewContext - view context

get

public java.lang.Object get(java.lang.Object key)
Generic getter.

Specified by:
get in interface java.util.Map
Parameters:
key - key
Returns:
value or null

put

public java.lang.Object put(java.lang.Object key,
                            java.lang.Object value)
Generic setter.

Specified by:
put in interface java.util.Map
Parameters:
key - key
value - value
Returns:
previous value

size

public int size()
Get the number of parameters.

Specified by:
size in interface java.util.Map
Returns:
number of parameters

isEmpty

public boolean isEmpty()
Check for the presence of parameters.

Specified by:
isEmpty in interface java.util.Map
Returns:
true if empty

containsKey

public boolean containsKey(java.lang.Object key)
Check for the presence of a parameter.

Specified by:
containsKey in interface java.util.Map
Parameters:
key - parameter name
Returns:
true if present

containsValue

public boolean containsValue(java.lang.Object value)
Check for the presence of a value.

Specified by:
containsValue in interface java.util.Map
Parameters:
value - value to find
Returns:
true if present

remove

public java.lang.Object remove(java.lang.Object key)
Remove a parameter (from extra values).

Specified by:
remove in interface java.util.Map
Parameters:
key - parameter name
Returns:
value or null

putAll

public void putAll(java.util.Map map)
Put all key/values from a map.

Specified by:
putAll in interface java.util.Map
Parameters:
map - source map

clear

public void clear()
Clear extra parameters.

Specified by:
clear in interface java.util.Map

keySet

public java.util.Set keySet()
Get the set of parameter names.

Specified by:
keySet in interface java.util.Map
Returns:
set of names

values

public java.util.Collection values()
Get the collection of values

Specified by:
values in interface java.util.Map
Returns:
collection of values

entrySet

public java.util.Set<java.util.Map.Entry> entrySet()
Specified by:
entrySet in interface java.util.Map


~ooOoo~