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

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

(defmethod attach-route :all
  [^Chain chain [_ & handlers-and-path]]
  (let [path (first handlers-and-path)]
    (if (string? path)
      (let [^List handlers (map handlers/ratpack-adapter (rest handlers-and-path))]
        (.handler chain path (Handlers/chain handlers)))
      (let [^List handlers (map handlers/ratpack-adapter handlers-and-path)]
        (.handler chain (Handlers/chain handlers))))))

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

  [^Chain chain [method & handlers-and-path]]
  (let [path (first handlers-and-path)]
    (if (string? path)
      (let [^Handler handler (-> (map handlers/ratpack-adapter (rest handlers-and-path))
                                 (Handlers/chain))]
        (case method
          :all (.handler chain path handler)
          :get (.get chain path handler)
          :post (.post chain path handler)
          :put (.put chain path handler)
          :patch (.patch chain path handler)
          :delete (.delete chain path handler)))
      (let [^Handler handler (-> (map handlers/ratpack-adapter handlers-and-path)
                                (Handlers/chain))]
        (case method
          :all (.handler chain handler)
          :get (.get chain handler)
          :post (.post chain handler)
          :put (.put chain handler)
          :patch (.patch chain handler)
          :delete (.delete chain handler))))))

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