public class ContextPathCompositeHandler extends java.lang.Object implements HttpHandler
HttpHandler
delegating requests to one of several HttpHandler
's
based on simple, prefix-based mappings.
This is intended as a coarse-grained mechanism for delegating requests to
one of several applications -- each represented by an HttpHandler
, with
the application "context path" (the prefix-based mapping) exposed via
ServerHttpRequest.getPath()
.
Modifier and Type | Field and Description |
---|---|
private java.util.Map<java.lang.String,HttpHandler> |
handlerMap |
Constructor and Description |
---|
ContextPathCompositeHandler(java.util.Map<java.lang.String,? extends HttpHandler> handlerMap) |
Modifier and Type | Method and Description |
---|---|
private static void |
assertValidContextPath(java.lang.String contextPath) |
<any> |
handle(ServerHttpRequest request,
ServerHttpResponse response)
Handle the given request and write to the response.
|
private static java.util.Map<java.lang.String,HttpHandler> |
initHandlers(java.util.Map<java.lang.String,? extends HttpHandler> map) |
private final java.util.Map<java.lang.String,HttpHandler> handlerMap
public ContextPathCompositeHandler(java.util.Map<java.lang.String,? extends HttpHandler> handlerMap)
private static java.util.Map<java.lang.String,HttpHandler> initHandlers(java.util.Map<java.lang.String,? extends HttpHandler> map)
private static void assertValidContextPath(java.lang.String contextPath)
public <any> handle(ServerHttpRequest request, ServerHttpResponse response)
HttpHandler
handle
in interface HttpHandler
request
- current requestresponse
- current response