Generic Servlet adapter that closes over its implementation functions.


(servlet & {:keys [init service destroy]})

Returns an instance of javax.servlet.Servlet using provided functions for its implementation. Arguments are key-value pairs of:

:init optional, initialization function taking two arguments: the Servlet and its ServletConfig

:service required, handler function taking three arguments: the Servlet, ServletRequest, and ServletResponse

:destroy optional, shutdown function taking one argument: the Servlet

The :init, :service, and :destroy options correspond to the Servlet interface methods of the same names.

Note: this function returns an instance, not a class. If you need a class with a static name (for example, to deploy to a Servlet container) use the Java class pedestal.servlet.ClojureVarServlet.