ring 2022-05-18

I'm trying to figure out how to mount a Java servlet (https://download.eclipse.org/jgit/site/6.1.0.202203080745-r/apidocs/org/eclipse/jgit/http/server/GitServlet.html) at a specific path (using Reitit) in a Ring handler. Is this possible? If so, any pointers as to how?

Depends on your server

The server is Jetty (embedded)

similar question asked in beginners earlier - but basically you need to do it at the server level

that's the way I have it set up now

when you start up the thing use :configurator

it's a bit annoying because I can't use my middleware with it

(i.e. I have to replicate it for the servlet)

there might be another way - let me figure out what a servlet is exactly real quick

there's this, which can translate servlet requests to a Ring requests, and a Ring responses to servlet responses: https://github.com/ring-clojure/ring/blob/master/ring-servlet/src/ring/util/servlet.clj

...but I'd want to translate in the other direction, so to speak

what is the middleware you want to put in the middle exactly?

maybe we can proxy a "delegating servlet" and make use of the stuff in the middle

something like this?

I have a bunch of middleware, but the most relevant here would be my custom middleware for auth and logging

...and yeah, something like that works, but I was hoping I'd be able to just find a way to stick some Ring middleware inbetween instead of extra servlets.