org.eclipse.jetty.rewrite.handler
Class RegexTargetHandler
java.lang.Object
org.eclipse.jetty.util.component.AbstractLifeCycle
org.eclipse.jetty.util.component.AggregateLifeCycle
org.eclipse.jetty.server.handler.AbstractHandler
org.eclipse.jetty.server.handler.AbstractHandlerContainer
org.eclipse.jetty.server.handler.HandlerWrapper
org.eclipse.jetty.server.handler.ScopedHandler
org.eclipse.jetty.rewrite.handler.RegexTargetHandler
- All Implemented Interfaces:
- Handler, HandlerContainer, Destroyable, Dumpable, LifeCycle
public class RegexTargetHandler
- extends ScopedHandler
A handle that uses regular expressions to select the target.
This handler applies a list of regex to target name mappings to the URIs of requests.
If the regex matches the URI, then the mapped target name is used in the nested
call to doScope(String, Request, HttpServletRequest, HttpServletResponse)
.
This handler should be installed as the first handler in a Context. It can be configured
either with direct calls to addPatternTarget(String, String)
or by setting
the context init parameters "org.eclipse.jetty.rewrite.handler.REGEX_MAPPINGS" to a comma
separated list of strings in the format regex==target.
Methods inherited from class org.eclipse.jetty.util.component.AggregateLifeCycle |
addBean, addBean, contains, dump, dump, dump, dump, dumpObject, dumpStdErr, getBean, getBeans, getBeans, isManaged, manage, removeBean, removeBeans, unmanage |
Methods inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle |
addLifeCycleListener, getState, getState, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
REGEX_MAPPINGS
public static final String REGEX_MAPPINGS
- See Also:
- Constant Field Values
RegexTargetHandler
public RegexTargetHandler()
addPatternTarget
public void addPatternTarget(String pattern,
String target)
- Add a pattern to target mapping.
- Parameters:
pattern
- The regular expression pattern to match.target
- The target (normally servlet name) to handle the request
doStart
protected void doStart()
throws Exception
- Description copied from class:
AggregateLifeCycle
- Start the managed lifecycle beans in the order they were added.
- Overrides:
doStart
in class ScopedHandler
- Throws:
Exception
- See Also:
HandlerWrapper.doStart()
doScope
public void doScope(String target,
Request baseRequest,
HttpServletRequest request,
HttpServletResponse response)
throws IOException,
ServletException
- Specified by:
doScope
in class ScopedHandler
- Throws:
IOException
ServletException
doHandle
public void doHandle(String target,
Request baseRequest,
HttpServletRequest request,
HttpServletResponse response)
throws IOException,
ServletException
- Specified by:
doHandle
in class ScopedHandler
- Throws:
IOException
ServletException
dump
public void dump(Appendable out,
String indent)
throws IOException
- Specified by:
dump
in interface Dumpable
- Overrides:
dump
in class AbstractHandlerContainer
- Throws:
IOException
Copyright © 1995-2012 Mort Bay Consulting. All Rights Reserved.