Fork me on GitHub
#reitit
<
2023-06-28
>
Patrick01:06:15

Hi, I keep getting this error. I've tried changing my java version, didn't work. Deleted reitit and ring from ~/.m2 and re-ran lein deps. If anyone knows what I need to do that would be great! Syntax error (ClassNotFoundException) compiling . at (ring/middleware/multipart_params.clj:29:5). javax.servlet.http.HttpServletRequest

hifumi12302:06:29

That’s not related to Reitit at all. It looks like you’re using ring-core without the corresponding servlet library. cf. https://github.com/ring-clojure/ring#upgrade-notice

Patrick02:06:15

Brilliant thank you. I'll look into this!

tvirolai10:06:49

When defining routes for an application like this, is it possible to somehow add middleware for the resource-handler and default handler? I can't seem to find any examples of this.

(def app
  (ring/ring-handler
   (ring/router app-routes)
   (ring/routes
    (ring/create-resource-handler {:path "/v2"})
    (ring/create-default-handler {:not-found (constantly not-found)}))))

tvirolai11:06:13

Wrapping the resource / default handlers as usual seems to work.

(def app
  (ring/ring-handler
   (ring/router app-routes)
   (ring/routes
    (add-cors-headers (ring/create-resource-handler {:path "/v2"}))
    (ring/create-default-handler {:not-found (constantly not-found)}))))