Class Redirect
java.lang.Object
org.ocpsoft.rewrite.config.DefaultOperationBuilder
org.ocpsoft.rewrite.servlet.config.HttpOperation
org.ocpsoft.rewrite.servlet.config.Redirect
- All Implemented Interfaces:
Operation,OperationBuilder,Parameterized
An
Operation that performs redirects via HttpInboundServletRewrite.redirectPermanent(String) and
HttpInboundServletRewrite.redirectTemporary(String)- Author:
- Lincoln Baxter, III
-
Method Summary
Modifier and TypeMethodDescriptionvoidperformHttp(HttpServletRewrite event, EvaluationContext context) static RedirectCreate anOperationthat issues a permanentRedirect( 301HttpServletResponse.SC_MOVED_PERMANENTLY) to the given location.voidsetParameterStore(ParameterStore store) static RedirectCreate anOperationthat issues a temporaryRedirect( 302HttpServletResponse.SC_MOVED_TEMPORARILY) to the given location.Methods inherited from class org.ocpsoft.rewrite.servlet.config.HttpOperation
performMethods inherited from class org.ocpsoft.rewrite.config.DefaultOperationBuilder
and
-
Method Details
-
performHttp
- Specified by:
performHttpin classHttpOperation
-
permanent
Create anOperationthat issues a permanentRedirect( 301HttpServletResponse.SC_MOVED_PERMANENTLY) to the given location. If the given location is not the same asHttpServletRewrite.getAddress(), this will change the browserURLand result in a new request.Note that in order to redirect to a resource within the
ServletContext, you must prepend theServletContext.getContextPath().For example:
Redirect.permanent(contextPath + "/example/location.html")
The given location may be parameterized:
/store/global /store/{category}
/store/{category}/item/{itemId}
...- Parameters:
location-ParameterizedPatternspecifying the target location.- See Also:
-
temporary
Create anOperationthat issues a temporaryRedirect( 302HttpServletResponse.SC_MOVED_TEMPORARILY) to the given location. If the given location is not the same asHttpServletRewrite.getAddress(), this will change the browserURLand result in a new request.Note that in order to redirect within the
ServletContext, you must prepend theServletContext.getContextPath().For example:
Redirect.temporary(contextPath + "/example/location.html")
The given location may be parameterized:
/store/global /store/{category}
/store/{category}/item/{itemId}
...- Parameters:
location-ParameterizedPatternspecifying the target location.- See Also:
-
getTargetExpression
-
getRequiredParameterNames
- Specified by:
getRequiredParameterNamesin interfaceParameterized
-
setParameterStore
- Specified by:
setParameterStorein interfaceParameterized
-