handy_httpd.components.handler

Contains core components for the HTTP handler structure.

Members

Aliases

HttpRequestHandlerFunction
alias HttpRequestHandlerFunction = void function(ref HttpRequestContext)

An alias for the signature of a function capable of handling requests. It's just a void function that takes a single HttpRequestContext parameter. It is acceptable to throw exceptions from the function.

Classes

BasicServerExceptionHandler
class BasicServerExceptionHandler

A basic implementation of the ServerExceptionHandler which gracefully handles HttpStatusException by setting the response status, and defaults to a 500 INTERNAL SERVER ERROR respones for all other exceptions. If the response has already been flushed, an error will be logged.

HttpStatusException
class HttpStatusException

An exception that can be thrown to indicate that the current request should immediately respond with a specified status, short-circuiting any other handler logic. Note that it is still the responsibility of the server's exception handler to honor this exception, but by default, the BasicServerExceptionHandler does honor it.

Functions

noOpHandler
HttpRequestHandler noOpHandler()

Helper method for an HttpRequestHandler that simply responds with a 503 to any request.

toHandler
HttpRequestHandler toHandler(HttpRequestHandlerFunction fn)

Helper method to produce an HttpRequestHandler from a function.

Interfaces

HttpRequestHandler
interface HttpRequestHandler

Interface for any component that handles HTTP requests.

ServerExceptionHandler
interface ServerExceptionHandler

A specialized handler which is used for situations in which you'd like to gracefully handle an exception that occurs during processing a request.

Structs

HttpRequestContext
struct HttpRequestContext

A simple container for the components that are available in the context of handling an HttpRequest. This includes the request, response, server, and other associated objects.