http4k / org.http4k.routing

Package org.http4k.routing

Code for routing HTTP messages inside server implementations.


Name Summary
PathMethod data class PathMethod
ResourceLoader interface ResourceLoader
RoutedRequest data class RoutedRequest : Request
RoutedResponse class RoutedResponse : Response
Router interface Router
Provides matching of a Request to an HttpHandler which can service it.
RoutingHttpHandler interface RoutingHttpHandler : Router, HttpHandler
Composite HttpHandler which can potentially service many different URL patterns. Should return a 404 Response if it cannot service a particular Request.
RoutingWsHandler interface RoutingWsHandler : WsHandler

Extensions for External Classes

Name Summary


Name Summary
path fun Request.path(name: String): String?
routes fun routes(vararg list: Pair<Method, HttpHandler>): RoutingHttpHandler
fun routes(vararg list: RoutingHttpHandler): RoutingHttpHandler
static fun static(resourceLoader: ResourceLoader = ResourceLoader.Classpath(), vararg extraPairs: Pair<String, ContentType>): RoutingHttpHandler
Serve static content using the passed ResourceLoader. Note that for security, by default ONLY mime-types registered in mime.types (resource file) will be served. All other types are registered as application/octet-stream and are not served.
websockets fun websockets(ws: WsConsumer): WsHandler
fun websockets(vararg list: RoutingWsHandler): RoutingWsHandler