Module stincmale.server
Package stincmale.server.netty4.tcp.http
Class SimpleHttpRequestDispatcherByUrl
java.lang.Object
stincmale.server.reqres.RequestDispatcherByProcessorName<RequestWithMetadata<? extends FullHttpRequest>,FullHttpResponse>
stincmale.server.netty4.tcp.http.SimpleHttpRequestDispatcherByUrl
- All Implemented Interfaces:
RequestDispatcher<RequestWithMetadata<? extends FullHttpRequest>,FullHttpResponse>
,RequestProcessor<RequestWithMetadata<? extends FullHttpRequest>,FullHttpResponse>
@ThreadSafe public class SimpleHttpRequestDispatcherByUrl extends RequestDispatcherByProcessorName<RequestWithMetadata<? extends FullHttpRequest>,FullHttpResponse>
RequestDispatcherByProcessorName
that uses URI path of an HTTP request as the name of a
RequestProcessor
.-
Constructor Summary
Constructors Constructor Description SimpleHttpRequestDispatcherByUrl(Map<String,? extends RequestProcessor<RequestWithMetadata<? extends FullHttpRequest>,FullHttpResponse>> processors, String contextPath)
-
Method Summary
Modifier and Type Method Description protected String
getProcessorName(RequestWithMetadata<? extends FullHttpRequest> request)
This method must return name of aRequestProcessor
which can be found among available processors.Methods inherited from class stincmale.server.reqres.RequestDispatcherByProcessorName
getProcessors, process
-
Constructor Details
-
SimpleHttpRequestDispatcherByUrl
public SimpleHttpRequestDispatcherByUrl(Map<String,? extends RequestProcessor<RequestWithMetadata<? extends FullHttpRequest>,FullHttpResponse>> processors, String contextPath)- Parameters:
processors
- SeeRequestDispatcherByProcessorName(java.util.Map)
.contextPath
- A portion of the HTTP request URI that indicates the context of the request. The context path always comes first in a request URI. The path starts with a/
character but does not end with a/
character. Use empty string""
to specify the root context path.contextPath
is used by thegetProcessorName(RequestWithMetadata)
method. ThecontextPath
is subtracted from URI path of the HTTP request and the result is used as name of aRequestProcessor
:contextPath HTTP URL path getProcessorName() "" "/" "/" "/context/path" "/context/path/req" "/req" "/context/path" "/req" "/req"
-
-
Method Details
-
getProcessorName
Description copied from class:RequestDispatcherByProcessorName
This method must return name of aRequestProcessor
which can be found among available processors.- Specified by:
getProcessorName
in classRequestDispatcherByProcessorName<RequestWithMetadata<? extends FullHttpRequest>,FullHttpResponse>
-