Fork me on GitHub
#ring
<
2022-05-18
>
wombawomba13:05:52

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?

emccue13:05:52

Depends on your server

wombawomba13:05:27

The server is Jetty (embedded)

emccue13:05:52

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

wombawomba13:05:05

that's the way I have it set up now

emccue13:05:09

when you start up the thing use :configurator

wombawomba13:05:17

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

wombawomba13:05:29

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

emccue13:05:45

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

wombawomba13:05:15

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

wombawomba13:05:26

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

emccue13:05:51

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

emccue13:05:12

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

emccue13:05:18

something like this?

wombawomba13:05:29

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

wombawomba15:05:47

...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.