Package com.soklet.web.request
Class DefaultRequestHandler
java.lang.Object
com.soklet.web.request.DefaultRequestHandler
- All Implemented Interfaces:
RequestHandler
- Since:
- 1.0.0
- Author:
- Mark Allen
-
Constructor Summary
ConstructorDescriptionDefaultRequestHandler
(InstanceProvider instanceProvider) DefaultRequestHandler
(InstanceProvider instanceProvider, ValueConverterRegistry valueConverterRegistry) -
Method Summary
Modifier and TypeMethodDescriptionhandleRequest
(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Route route) Invokes theresourceMethod
associated with the givenroute
.
-
Constructor Details
-
DefaultRequestHandler
-
DefaultRequestHandler
public DefaultRequestHandler(InstanceProvider instanceProvider, ValueConverterRegistry valueConverterRegistry)
-
-
Method Details
-
handleRequest
public Optional<Object> handleRequest(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Route route) throws Exception Description copied from interface:RequestHandler
Invokes theresourceMethod
associated with the givenroute
.Implementors must ensure
resourceMethod
parameters are appropriately set. For example, a parameter annotated withRequestHeader
must have its value set according to the corresponding header inhttpServletRequest
.- Specified by:
handleRequest
in interfaceRequestHandler
- Parameters:
httpServletRequest
- Servlet requesthttpServletResponse
- Servlet responseroute
- The route to invoke- Returns:
- The result of the
route
invocation - Throws:
Exception
- An exception thrown during route invocation
-