make-service-method

ring.util.servlet

  • (make-service-method handler)
Turns a handler into a function that takes the same arguments and has the
same return value as the service method in the HttpServlet class.

0 Examples top

Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source ring/util/servlet.clj:106 top

(defn make-service-method
  "Turns a handler into a function that takes the same arguments and has the
  same return value as the service method in the HttpServlet class."
  [handler]
  (fn [#^HttpServlet servlet
       #^HttpServletRequest request
       #^HttpServletResponse response]
    (.setCharacterEncoding response "UTF-8")
    (let [request-map (-> request
                        (build-request-map)
                        (merge-servlet-keys servlet request response))]
      (if-let [response-map (handler request-map)]
        (update-servlet-response response response-map)
        (throw (NullPointerException. "Handler returned nil"))))))
Vars in ring.util.servlet/make-service-method: defn fn if-let let
Used in 0 other vars

Comments top

No comments for make-service-method. Log in to add a comment.