Interface Server.RequestHandler
- Enclosing interface:
Server
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Request/response processing contract for
Server
implementations.
This is used internally by Soklet
instances to "talk" to a Server
via Server.initialize(SokletConfiguration, RequestHandler)
. It's the responsibility of the Server
to implement HTTP mechanics: read bytes from the request, write bytes to the response, and so forth.
Most Soklet applications will use DefaultServer
and therefore do not need to implement this interface directly.
- Author:
- Mark Allen
-
Method Summary
Modifier and TypeMethodDescriptionvoid
handleRequest
(Request request, Consumer<RequestResult> requestResultConsumer) Callback to be invoked by aServer
implementation after it has received an HTTP request but prior to writing an HTTP response.
-
Method Details
-
handleRequest
void handleRequest(@Nonnull Request request, @Nonnull Consumer<RequestResult> requestResultConsumer) Callback to be invoked by aServer
implementation after it has received an HTTP request but prior to writing an HTTP response.The
Server
is responsible for converting its internal request representation into aRequest
, which aSoklet
instance consumes and performs Soklet application request processing logic.The
Soklet
instance will generate aMarshaledResponse
for the request, which it "hands back" to theServer
to be sent over the wire to the client.
-