   (:import ratpack.handling.Context
            ratpack.handling.Chain
            ratpack.handling.Handlers
+           ratpack.handling.Handler
            ratpack.error.ServerErrorHandler
            ratpack.registry.RegistrySpec
            ratpack.func.Action

  [^Chain chain [method & handlers-and-path]]
  (let [path (first handlers-and-path)]
    (if (string? path)
      (let [^List handlers (map handlers/ratpack-adapter (rest handlers-and-path))]
        (condp = method
          :get (.get chain path (Handlers/chain handlers))
          :post (.post chain path (Handlers/chain handlers))
          :put (.put chain path (Handlers/chain handlers))
          :patch (.patch chain path (Handlers/chain handlers))
          :delete (.delete chain path (Handlers/chain handlers))))
      (let [^List handlers (map handlers/ratpack-adapter handlers-and-path)]
        (condp = method
          :get (.get chain (Handlers/chain handlers))
          :post (.post chain (Handlers/chain handlers))
          :put (.put chain (Handlers/chain handlers))
          :patch (.patch chain (Handlers/chain handlers))
          :delete (.delete chain (Handlers/chain handlers)))))))

(defn routes
  "Is a high order function that access a routes vector

  (let [callback #(reduce attach-route % handlers)]
    (.prefix chain path ^Action (helpers/action callback))))

(defmethod attach-route :error
  [^Chain chain [_ error-handler]]
  (letfn [(on-register [^RegistrySpec rspec]
