All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.http4k.servlet.HttpHandlerServlet.kt Maven / Gradle / Ivy

There is a newer version: 5.31.0.0
Show newest version
package org.http4k.servlet

import org.http4k.core.HttpHandler
import javax.servlet.http.HttpServlet
import javax.servlet.http.HttpServletRequest
import javax.servlet.http.HttpServletResponse

/**
 * Simple servlet which wraps an http4k HttpHandler
 */
class HttpHandlerServlet(handler: HttpHandler) : HttpServlet() {
    private val adapter = Http4kServletAdapter(handler)

    override fun service(req: HttpServletRequest, resp: HttpServletResponse) = adapter.handle(req, resp)
}

fun HttpHandler.asServlet() = HttpHandlerServlet(this)




© 2015 - 2024 Weber Informatics LLC | Privacy Policy