Package io.fusionauth.http.server
Interface HTTPHandler
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Handles an HTTP request from a client.
- Author:
- Brian Pontarelli
-
Method Summary
Modifier and TypeMethodDescriptionvoidhandle(HTTPRequest request, HTTPResponse response) Handles the processing of a request and filling out the response.
-
Method Details
-
handle
Handles the processing of a request and filling out the response. If this method returns normally, it is assumed that the HTTP response is complete and the headers match the body (or lack thereof) so that the client can process the response properly.If the handler wishes to close the connection, it should either include the header
Connection: closeor throw an exception. If an exception is thrown, the HTTPServer will determine if the response is malformed (i.e. truncated), in which case the connection will be closed automatically, or if the response can be changed to a500response.- Parameters:
request- The request from the client.response- The response sent back to the client.- Throws:
Exception- If the processing failed and the response should be truncated or replaced. The connection will always be closed.
-