Class RewriteHandler

java.lang.Object
org.eclipse.jetty.util.component.AbstractLifeCycle
org.eclipse.jetty.util.component.ContainerLifeCycle
org.eclipse.jetty.server.Handler.Abstract
org.eclipse.jetty.server.Handler.AbstractContainer
org.eclipse.jetty.server.Handler.Wrapper
org.eclipse.jetty.rewrite.handler.RewriteHandler
All Implemented Interfaces:
org.eclipse.jetty.server.Handler, org.eclipse.jetty.server.Handler.Container, org.eclipse.jetty.server.Handler.Singleton, org.eclipse.jetty.server.Request.Handler, org.eclipse.jetty.util.component.Container, org.eclipse.jetty.util.component.Destroyable, org.eclipse.jetty.util.component.Dumpable, org.eclipse.jetty.util.component.Dumpable.DumpableContainer, org.eclipse.jetty.util.component.LifeCycle, org.eclipse.jetty.util.thread.Invocable

public class RewriteHandler extends org.eclipse.jetty.server.Handler.Wrapper

RewriteHandler rewrites incoming requests through a set of Rules.

RewriteHandler can rewrite the request URI, but also HTTP cookies and HTTP headers. When a rule matches, RewriteHandler can perform actions such as redirect to a different URI or directly produce a response with a configurable HTTP status code.

Rules can be grouped into a RuleContainer, which is itself a Rule. If the container rule matches (for example, virtual host name when using VirtualHostRuleContainer), then the contained rules will be applied.

Rules are applied in the same sequence they are added to the container. If a rule matches, it applies some logic (typically wrapping the request), and the next rule is invoked (with the wrapped request), until a terminating rule is found, or all the rules have been processed.

Request URI matching is performed either via Servlet pattern matching (using PatternRule subclasses), via regular expression matching (using RegexRule subclasses), or by a custom implementation of Rule.