rewrite-config-servlet 2.0.0.Beta3

org.ocpsoft.rewrite.servlet.config
Class RequestParameter

java.lang.Object
  extended by org.ocpsoft.rewrite.config.DefaultConditionBuilder
      extended by org.ocpsoft.rewrite.servlet.config.HttpCondition
          extended by org.ocpsoft.rewrite.servlet.config.RequestParameter
All Implemented Interfaces:
Condition, ConditionBuilder, Parameterized

public class RequestParameter
extends HttpCondition
implements Parameterized

A Condition that inspects values returned by ServletRequest.getParameterMap()

Author:
Lincoln Baxter, III

Method Summary
 boolean evaluateHttp(HttpServletRewrite event, EvaluationContext context)
           
static RequestParameter exists(String name)
          Create a Condition that matches against the existence of a request parameter with a name matching the given pattern.
 ParameterizedPatternParser getNameExpression()
          Get the ParameterizedPattern of the request parameter name.
 Set<String> getRequiredParameterNames()
           
 ParameterizedPatternParser getValueExpression()
          Get the ParameterizedPattern of the request parameter value.
static RequestParameter matches(String name, String value)
          Create a Condition that matches against both request parameter names and values.
static RequestParameter matchesAll(String name, String value)
           
 void setParameterStore(ParameterStore store)
           
 String toString()
           
static RequestParameter valueExists(String value)
          Create a Condition that matches only against the existence of a request parameter value matching the given pattern.
 
Methods inherited from class org.ocpsoft.rewrite.servlet.config.HttpCondition
evaluate
 
Methods inherited from class org.ocpsoft.rewrite.config.DefaultConditionBuilder
and, andNot, or, orNot
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

matches

public static RequestParameter matches(String name,
                                       String value)
Create a Condition that matches against both request parameter names and values.

Parameter name and value expressions may be parameterized:

RequestParameter.matches("username", "guest")
RequestParameter.matches("username", "{name}")
RequestParameter.matches("{anything}", "{value}")

Parameters:
name - ParameterizedPattern matching the request parameter name.
value - ParameterizedPattern matching the request parameter value.
See Also:
{@link HttpServletRequest#getParameterMap()}

matchesAll

public static RequestParameter matchesAll(String name,
                                          String value)

exists

public static RequestParameter exists(String name)
Create a Condition that matches against the existence of a request parameter with a name matching the given pattern. The parameter value is ignored.

Parameter name expressions may be parameterized:

RequestParameter.exists("username")
RequestParameter.exists("{name}")
...

Parameters:
name - ParameterizedPattern matching the request parameter name.
See Also:
{@link HttpServletRequest#getParameterMap()}

valueExists

public static RequestParameter valueExists(String value)
Create a Condition that matches only against the existence of a request parameter value matching the given pattern. The parameter name is ignored.

Parameter value expressions may be parameterized:

RequestParameter.valueExists("guest")
RequestParameter.valueExists("{username}")
...

Parameters:
name - ParameterizedPattern matching the request parameter name.
See Also:
{@link HttpServletRequest#getParameterMap()}

evaluateHttp

public boolean evaluateHttp(HttpServletRewrite event,
                            EvaluationContext context)
Specified by:
evaluateHttp in class HttpCondition

getNameExpression

public ParameterizedPatternParser getNameExpression()
Get the ParameterizedPattern of the request parameter name.


getValueExpression

public ParameterizedPatternParser getValueExpression()
Get the ParameterizedPattern of the request parameter value.


toString

public String toString()
Overrides:
toString in class Object

getRequiredParameterNames

public Set<String> getRequiredParameterNames()
Specified by:
getRequiredParameterNames in interface Parameterized

setParameterStore

public void setParameterStore(ParameterStore store)
Specified by:
setParameterStore in interface Parameterized

rewrite-config-servlet 2.0.0.Beta3

Copyright © 2013 OCPsoft. All Rights Reserved.