Class PathMappingsHandler

java.lang.Object
org.eclipse.jetty.util.component.AbstractLifeCycle
org.eclipse.jetty.util.component.ContainerLifeCycle
All Implemented Interfaces:
Handler, Handler.Container, 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
Direct Known Subclasses:
PathMappingsHandler.NoContext

public class PathMappingsHandler extends Handler.AbstractContainer

A Handler that delegates to other handlers through a configured PathMappings.

PathMappingHandler pathMappingsHandler = new PathMappingsHandler(); pathMappingsHandler.addMapping(new ServletPathSpec("/"), new MyRootHandler()); pathMappingsHandler.addMapping(new ServletPathSpec("/index.html"), new MyIndexHandler()); pathMappingsHandler.addMapping(new ServletPathSpec("/static/*"), new ResourceHandler()); pathMappingsHandler.addMapping(new RegexPathSpec("/rest/.*\\.api$"), new RestHandler()); pathMappingsHandler.addMapping(new UriTemplatePathSpec("/chat/{channel}/{mode}"), new ChatHandler());

Request handling can access the PathSpec used via the Request#getAttribute on the name PATHSPEC_ATTR