Module stincmale.server
Package stincmale.server.reqres
Class RequestDispatcherByProcessorName<RQ,RS>
java.lang.Object
stincmale.server.reqres.RequestDispatcherByProcessorName<RQ,RS>
- All Implemented Interfaces:
RequestDispatcher<RQ,RS>
,RequestProcessor<RQ,RS>
- Direct Known Subclasses:
SimpleHttpRequestDispatcherByUrl
,SpringRequestDispatcher
@ThreadSafe public abstract class RequestDispatcherByProcessorName<RQ,RS> extends Object implements RequestDispatcher<RQ,RS>
-
Constructor Summary
Constructors Modifier Constructor Description protected
RequestDispatcherByProcessorName(Map<String,? extends RequestProcessor<RQ,RS>> processors)
-
Method Summary
Modifier and Type Method Description protected abstract String
getProcessorName(RQ request)
This method must return name of aRequestProcessor
which can be found among available processors.protected Map<String,RequestProcessor<RQ,RS>>
getProcessors()
CompletionStage<RS>
process(RQ request)
CallsgetProcessorName(java.lang.Object)
to determineRequestProcessor
's name, finds theRequestProcessor
by this name among available processors and delegates processing of therequest
to the foundRequestProcessor
.
-
Constructor Details
-
RequestDispatcherByProcessorName
protected RequestDispatcherByProcessorName(Map<String,? extends RequestProcessor<RQ,RS>> processors)- Parameters:
processors
-Map
that contains availableRequestProcessor
s as values and names ofRequestProcessor
s as keys.
-
-
Method Details
-
process
CallsgetProcessorName(java.lang.Object)
to determineRequestProcessor
's name, finds theRequestProcessor
by this name among available processors and delegates processing of therequest
to the foundRequestProcessor
.- Specified by:
process
in interfaceRequestProcessor<RQ,RS>
- Returns:
CompletionStage
that will be completed when the result is ready. If there is no any result, then thisCompletionStage
may be completed withnull
.
-
getProcessors
-
getProcessorName
This method must return name of aRequestProcessor
which can be found among available processors.
-