Package com.soklet.web.request
Interface RequestHandler
- All Known Implementing Classes:
DefaultRequestHandler
public interface RequestHandler
Contract for executing a Java method to handle an HTTP request.
- Since:
- 1.0.0
- Author:
- Mark Allen
-
Method Summary
Modifier and TypeMethodDescriptionhandleRequest(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Route route) Invokes theresourceMethodassociated with the givenroute.
-
Method Details
-
handleRequest
Optional<Object> handleRequest(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Route route) throws Exception Invokes theresourceMethodassociated with the givenroute.Implementors must ensure
resourceMethodparameters are appropriately set. For example, a parameter annotated withRequestHeadermust have its value set according to the corresponding header inhttpServletRequest.- Parameters:
httpServletRequest- Servlet requesthttpServletResponse- Servlet responseroute- The route to invoke- Returns:
- The result of the
routeinvocation - Throws:
Exception- An exception thrown during route invocation
-