rewrite-impl-servlet 1.0.2.Final

org.ocpsoft.rewrite.servlet.config
Class Redirect

java.lang.Object
  extended by org.ocpsoft.rewrite.config.OperationBuilder
      extended by org.ocpsoft.rewrite.servlet.config.HttpOperation
          extended by org.ocpsoft.rewrite.servlet.config.Redirect
All Implemented Interfaces:
Operation, Parameterized<OperationParameterBuilder<RegexOperationParameterBuilder,java.lang.String>,java.lang.String>, ParameterizedOperation<OperationParameterBuilder<RegexOperationParameterBuilder,java.lang.String>,java.lang.String>

public class Redirect
extends HttpOperation
implements ParameterizedOperation<OperationParameterBuilder<RegexOperationParameterBuilder,java.lang.String>,java.lang.String>

An Operation that performs redirects via HttpInboundServletRewrite.redirectPermanent(String) and HttpInboundServletRewrite.redirectTemporary(String)

Author:
Lincoln Baxter, III

Method Summary
 void performHttp(HttpServletRewrite event, EvaluationContext context)
           
static Redirect permanent(java.lang.String location)
          Issue a permanent redirect ( 301 HttpServletResponse.SC_MOVED_PERMANENTLY ) to the given location.
static Redirect temporary(java.lang.String location)
          Issue a temporary redirect ( 302 HttpServletResponse.SC_MOVED_TEMPORARILY ) to the given location.
 RegexOperationParameterBuilder where(java.lang.String param)
           
 RegexOperationParameterBuilder where(java.lang.String param, Binding binding)
           
 RegexOperationParameterBuilder where(java.lang.String param, java.lang.String pattern)
           
 RegexOperationParameterBuilder where(java.lang.String param, java.lang.String pattern, Binding binding)
           
 
Methods inherited from class org.ocpsoft.rewrite.servlet.config.HttpOperation
perform
 
Methods inherited from class org.ocpsoft.rewrite.config.OperationBuilder
and
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.ocpsoft.rewrite.param.ParameterizedOperation
and
 
Methods inherited from interface org.ocpsoft.rewrite.config.Operation
perform
 

Method Detail

performHttp

public void performHttp(HttpServletRewrite event,
                        EvaluationContext context)
Specified by:
performHttp in class HttpOperation

permanent

public static Redirect permanent(java.lang.String location)
Issue a permanent redirect ( 301 HttpServletResponse.SC_MOVED_PERMANENTLY ) to the given location. If the given location is not the same as HttpServletRewrite.getURL(), this will change the browser URL and result in a new request. Note that in order to redirect within the ServletContext, you must prepend the ServletContext.getContextPath() manually.

The given location may be parameterized using the following format:

/example/{param}
/example/{value}/sub/{value2}
... and so on

By default, matching parameter values are bound to the EvaluationContext.

See also where(String)


temporary

public static Redirect temporary(java.lang.String location)
Issue a temporary redirect ( 302 HttpServletResponse.SC_MOVED_TEMPORARILY ) to the given location. If the given location is not the same as HttpServletRewrite.getURL(), this will change the browser URL and result in a new request. Note that in order to redirect within the ServletContext, you must prepend the ServletContext.getContextPath() manually.

The given location may be parameterized using the following format:

/example/{param}
/example/{value}/sub/{value2}
... and so on

By default, matching parameter values are bound to the EvaluationContext.

See also where(String)


where

public RegexOperationParameterBuilder where(java.lang.String param)
Specified by:
where in interface Parameterized<OperationParameterBuilder<RegexOperationParameterBuilder,java.lang.String>,java.lang.String>

where

public RegexOperationParameterBuilder where(java.lang.String param,
                                            java.lang.String pattern)
Specified by:
where in interface Parameterized<OperationParameterBuilder<RegexOperationParameterBuilder,java.lang.String>,java.lang.String>

where

public RegexOperationParameterBuilder where(java.lang.String param,
                                            java.lang.String pattern,
                                            Binding binding)
Specified by:
where in interface Parameterized<OperationParameterBuilder<RegexOperationParameterBuilder,java.lang.String>,java.lang.String>

where

public RegexOperationParameterBuilder where(java.lang.String param,
                                            Binding binding)
Specified by:
where in interface Parameterized<OperationParameterBuilder<RegexOperationParameterBuilder,java.lang.String>,java.lang.String>

rewrite-impl-servlet 1.0.2.Final

Copyright © 2012 OCPsoft. All Rights Reserved.