public class RegexTargetHandler extends ScopedHandler
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.
AbstractLifeCycle.AbstractLifeCycleListener
LifeCycle.Listener
Modifier and Type | Field and Description |
---|---|
static String |
REGEX_MAPPINGS |
_nextScope, _outerScope
_handler
_listeners, FAILED, RUNNING, STARTED, STARTING, STOPPED, STOPPING
Constructor and Description |
---|
RegexTargetHandler() |
Modifier and Type | Method and Description |
---|---|
void |
addPatternTarget(String pattern,
String target)
Add a pattern to target mapping.
|
void |
doHandle(String target,
Request baseRequest,
HttpServletRequest request,
HttpServletResponse response) |
void |
doScope(String target,
Request baseRequest,
HttpServletRequest request,
HttpServletResponse response) |
protected void |
doStart()
Start the managed lifecycle beans in the order they were added.
|
void |
dump(Appendable out,
String indent) |
handle, never, nextHandle, nextScope
destroy, doStop, expandChildren, getHandler, getHandlers, getNestedHandlerByClass, setHandler, setServer
expandHandler, findContainerOf, getChildHandlerByClass, getChildHandlers, getChildHandlersByClass
dumpThis, getServer
addBean, addBean, contains, dump, dump, dump, dump, dumpObject, dumpStdErr, getBean, getBeans, getBeans, isManaged, manage, removeBean, removeBeans, unmanage
addLifeCycleListener, getState, getState, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addLifeCycleListener, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop
public static final String REGEX_MAPPINGS
public void addPatternTarget(String pattern, String target)
pattern
- The regular expression pattern to match.target
- The target (normally servlet name) to handle the requestprotected void doStart() throws Exception
AggregateLifeCycle
doStart
in class ScopedHandler
Exception
HandlerWrapper.doStart()
public void doScope(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
doScope
in class ScopedHandler
IOException
ServletException
public void doHandle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
doHandle
in class ScopedHandler
IOException
ServletException
public void dump(Appendable out, String indent) throws IOException
dump
in interface Dumpable
dump
in class AbstractHandlerContainer
IOException
Copyright © 1995-2012 Mort Bay Consulting. All Rights Reserved.