com.sun.jersey.server.impl.uri.rules
Class RightHandPathRule

java.lang.Object
  extended by com.sun.jersey.server.impl.uri.rules.RightHandPathRule
All Implemented Interfaces:
UriRule

public class RightHandPathRule
extends java.lang.Object
implements UriRule

Adapter to an existing rule that accepts the rule using the last capturing group value as the URI path.

This rule assumes that the pattern used to match this rule has certain contraints. If a pattern contains one or more capturing groups then the last capturing group MUST occur at the end of the pattern and MUST be '(/.*)?' or '(/)?'.

If the source from which the pattern was derived ends in a '/' and the matched path does not end in a '/' then a temporary redirect response is returned with a path that is the matched path appened with '/'.

Author:
Paul.Sandoz@Sun.Com

Constructor Summary
RightHandPathRule(boolean redirect, boolean patternEndsInSlash, UriRule rule)
           
 
Method Summary
 boolean accept(java.lang.CharSequence path, java.lang.Object resource, UriRuleContext context)
          Accept the rule.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RightHandPathRule

public RightHandPathRule(boolean redirect,
                         boolean patternEndsInSlash,
                         UriRule rule)
Parameters:
redirect - if true return a temporary redirect response if the path does not end in '/' and the pattern ends in '/'.
patternEndsInSlash - true if the pattern used to match with rule end in a '/', otherwise false.
rule - the URI rule that is adapted.
Method Detail

accept

public final boolean accept(java.lang.CharSequence path,
                            java.lang.Object resource,
                            UriRuleContext context)
Description copied from interface: UriRule
Accept the rule.

Specified by:
accept in interface UriRule
Parameters:
path - the URI path
resource - the current resource instance
context - the rule context
Returns:
if true then the rule was accepted, if false then the rule was not accepted.


Copyright © 2011 Sun Microsystems, Inc. All Rights Reserved.