Input
- handler input type.Output
- handler output type.public class BaseRequestDispatcher<Input,Output> extends Object implements GenericRequestDispatcher<Input,Output>
GenericRequestMapper
to find a GenericRequestHandlerChain
.
A GenericHandlerAdapter
is used to execute the discovered request handler type.
GenericRequestInterceptor
and GenericResponseInterceptor
instances may be configured globally on this dispatcher
to be executed for all requests. Interceptors set on the GenericRequestHandlerChain
level are also supported.
A GenericRequestMapper
is used to find exception handlers in the event of an unhandled exception during
request processing.Modifier and Type | Class and Description |
---|---|
static class |
BaseRequestDispatcher.Builder<Input,Output,Self extends BaseRequestDispatcher.Builder<Input,Output,Self>>
Base Request Dispatcher Builder.
|
Modifier and Type | Field and Description |
---|---|
protected GenericExceptionMapper<Input,Output> |
exceptionMapper
Exception mapper.
|
protected Collection<GenericHandlerAdapter<Input,Output>> |
handlerAdapters
Collection of handler adapters.
|
protected Collection<GenericRequestInterceptor<Input>> |
requestInterceptors
Collection of request interceptors.
|
protected Collection<GenericRequestMapper<Input,Output>> |
requestMappers
Collection of request mappers.
|
protected Collection<GenericResponseInterceptor<Input,Output>> |
responseInterceptors
Collection of response interceptors.
|
Modifier | Constructor and Description |
---|---|
protected |
BaseRequestDispatcher(Collection<GenericRequestMapper<Input,Output>> requestMappers,
GenericExceptionMapper<Input,Output> exceptionMapper,
Collection<GenericHandlerAdapter<Input,Output>> handlerAdapters,
Collection<GenericRequestInterceptor<Input>> requestInterceptors,
Collection<GenericResponseInterceptor<Input,Output>> responseInterceptors) |
Modifier and Type | Method and Description |
---|---|
static <Input,Output> |
builder()
Returns an instance of Builder.
|
Output |
dispatch(Input input)
Dispatches an incoming request to the appropriate handling code and returns any output.
|
static <Input,Output,Self extends BaseRequestDispatcher.Builder<Input,Output,Self>> |
forTypes(Class<Input> input,
Class<Output> output)
Returns an instance of Builder.
|
protected final Collection<GenericRequestMapper<Input,Output>> requestMappers
protected final GenericExceptionMapper<Input,Output> exceptionMapper
protected final Collection<GenericHandlerAdapter<Input,Output>> handlerAdapters
protected final Collection<GenericRequestInterceptor<Input>> requestInterceptors
protected final Collection<GenericResponseInterceptor<Input,Output>> responseInterceptors
protected BaseRequestDispatcher(Collection<GenericRequestMapper<Input,Output>> requestMappers, GenericExceptionMapper<Input,Output> exceptionMapper, Collection<GenericHandlerAdapter<Input,Output>> handlerAdapters, Collection<GenericRequestInterceptor<Input>> requestInterceptors, Collection<GenericResponseInterceptor<Input,Output>> responseInterceptors)
requestMappers
- Collection of request mappers.exceptionMapper
- Exception mapper.handlerAdapters
- Collection of handler adapters.requestInterceptors
- Collection of request interceptors.responseInterceptors
- Collection of response interceptors.public Output dispatch(Input input) throws AskSdkException
dispatch
in interface GenericRequestDispatcher<Input,Output>
input
- input to the dispatcherOutput
.AskSdkException
- is thrown when dispatch fails.public static <Input,Output,Self extends BaseRequestDispatcher.Builder<Input,Output,Self>> BaseRequestDispatcher.Builder<Input,Output,Self> forTypes(Class<Input> input, Class<Output> output)
Input
- handler input type.Output
- handler output type.Self
- of type Builder.input
- class of type Input.output
- class of type Output.BaseRequestDispatcher.Builder
.public static <Input,Output> BaseRequestDispatcher.Builder<Input,Output,?> builder()
Input
- handler input type.Output
- handler output type.BaseRequestDispatcher.Builder
.Copyright © 2023. All rights reserved.