     (let [metadata (meta handler)]
       (:handler-type metadata)))
   :default :catacumba/default)
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Adapters Implementation
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 (defmethod adapter :catacumba/default
   [handler]

           ratpack.http.TypedData
           ratpack.http.MutableHeaders
           ratpack.util.MultiValueMap
           ratpack.exec.Fulfiller
           ratpack.exec.Promise
           catacumba.impl.context.DefaultContext
           org.reactivestreams.Publisher
           java.util.concurrent.CompletableFuture

            context-params (ctx/context-params context)
            route-params (ctx/route-params context)
            context (-> (merge context context-params)
                        (assoc :route-params route-params))]
        (-> (ch/promise (fn [resolve] (handler context #(resolve %))))
            (ch/then #(handle-response % context)))))))

(defn build-request
  [^Request request]
   (let [local-address (.getLocalAddress request)
         remote-address (.getRemoteAddress request)
         body (Blocking/on (.getBody request))]
     {:server-port (.getPort local-address)
      :server-name (.getHostText local-address)
      :remote-addr (.getHostText remote-address)
      :uri (str "/" (.getPath request))
      :query-string (.getQuery request)
      :scheme :http
      :request-method (keyword (.. request getMethod getName toLowerCase))
      :headers (get-headers* request)
      :content-type (.. body getContentType getType)
      :content-length (Integer/parseInt (.. request getHeaders (get "Content-Length")))
      :character-encoding (.. body getContentType (getCharset "utf-8"))
      :body (.. body getInputStream)}))

(defmethod adapter :catacumba/ring
  [handler]
  (reify Handler
    (^void handle [_ ^Context ctx]
      (let [context (ctx/context ctx)
            p (ch/blocking
               (let [request (build-request (:request context))]
                 (handler request)))]
        (ch/then p (fn [response]
                     (when (satisfies? IHandlerResponse response)
                       (handle-response response context))))))))
