Interface HttpServer.RequestHandler
- Enclosing interface:
HttpServer
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
HttpServer implementations.
This is used internally by Soklet instances to "talk" to a HttpServer via HttpServer.initialize(SokletConfig, RequestHandler). It's the responsibility of the HttpServer to implement HTTP mechanics: read bytes from the request, write bytes to the response, and so forth.
Most Soklet applications will use Soklet's default HttpServer implementation and therefore do not need to implement this interface directly.
- Author:
- Mark Allen
-
Method Summary
Modifier and TypeMethodDescriptionvoidhandleRequest(@NonNull Request request, @NonNull Consumer<HttpRequestResult> requestResultConsumer) Callback to be invoked by aHttpServerimplementation after it has received an HTTP request but prior to writing an HTTP response.
-
Method Details
-
handleRequest
void handleRequest(@NonNull Request request, @NonNull Consumer<HttpRequestResult> requestResultConsumer) Callback to be invoked by aHttpServerimplementation after it has received an HTTP request but prior to writing an HTTP response.The
HttpServeris responsible for converting its internal request representation into aRequest, which aSokletinstance consumes and performs Soklet application request processing logic.The
Sokletinstance will generate aMarshaledResponsefor the request, which it "hands back" to theHttpServerto be sent over the wire to the client.- Parameters:
request- a SokletRequestrepresentation of theHttpServer's internal HTTP request datarequestResultConsumer- invoked bySokletwhen it's time for theHttpServerto write HTTP response data to the client
-