rewrite-config-servlet 2.0.0.Alpha3

org.ocpsoft.rewrite.servlet.config
Class Hostname

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.Hostname
All Implemented Interfaces:
Condition, ConditionBuilder, ConfigurationElement, Parameterized<IDomain,IDomain.DomainParameter,String>, IDomain

public class Hostname
extends HttpCondition
implements IDomain

A Condition that inspects the value of ServletRequest.getServerName()

Author:
Lincoln Baxter, III

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.ocpsoft.rewrite.servlet.config.IDomain
IDomain.DomainParameter, IDomain.IDomainParameter
 
Method Summary
 boolean evaluateHttp(HttpServletRewrite event, EvaluationContext context)
           
 ParameterizedPatternParser getDomainExpression()
           
 ParameterizedPatternParser getExpression()
          Get the underlying RegexParameterizedPatternBuilder for this Hostname
static Hostname matches(String pattern)
          Inspect the current request domain, comparing against the given pattern.
 String toString()
           
 IDomain.DomainParameter where(String param)
           
 IDomain withRequestBinding()
          Bind named parameters to the request parameter map.
 
Methods inherited from class org.ocpsoft.rewrite.servlet.config.HttpCondition
evaluate
 
Methods inherited from class org.ocpsoft.rewrite.config.DefaultConditionBuilder
and, andNot, create, or, orNot, wrap
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.ocpsoft.rewrite.config.ConditionBuilder
and, andNot, or, orNot
 
Methods inherited from interface org.ocpsoft.rewrite.config.Condition
evaluate
 

Method Detail

matches

public static Hostname matches(String pattern)
Inspect the current request domain, comparing against the given pattern.

The given pattern may be parameterized using the following format:

example.com {domain}.com
www.{domain}.{suffix}
... and so on

By default, matching parameter values are bound to the EvaluationContext. See also where(String)


where

public IDomain.DomainParameter where(String param)
Specified by:
where in interface Parameterized<IDomain,IDomain.DomainParameter,String>

evaluateHttp

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

getExpression

public ParameterizedPatternParser getExpression()
Get the underlying RegexParameterizedPatternBuilder for this Hostname

See also: where(String)


toString

public String toString()
Overrides:
toString in class Object

withRequestBinding

public IDomain withRequestBinding()
Description copied from interface: IDomain
Bind named parameters to the request parameter map.

Specified by:
withRequestBinding in interface IDomain

getDomainExpression

public ParameterizedPatternParser getDomainExpression()
Specified by:
getDomainExpression in interface IDomain

rewrite-config-servlet 2.0.0.Alpha3

Copyright © 2013 OCPsoft. All Rights Reserved.