This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-11-10
Channels
- # announcements (3)
- # asami (19)
- # babashka (38)
- # beginners (42)
- # cider (19)
- # clojure (17)
- # clojure-europe (34)
- # clojure-hungary (3)
- # clojure-nl (1)
- # clojure-norway (53)
- # clojure-uk (7)
- # clojuredesign-podcast (34)
- # conjure (2)
- # cursive (7)
- # data-science (13)
- # datalevin (3)
- # datomic (19)
- # dev-tooling (1)
- # events (1)
- # honeysql (2)
- # hyperfiddle (31)
- # integrant (16)
- # juxt (39)
- # missionary (14)
- # nrepl (14)
- # off-topic (57)
- # overtone (22)
- # podcasts-discuss (1)
- # practicalli (32)
- # reitit (12)
- # releases (2)
- # ring (13)
- # ring-swagger (2)
- # sql (85)
- # squint (75)
I've searched the web and Slack and failed to figure out how to serve a standard Servlet from a Java library under a router/server started by Ring. It seems this question comes up every now and again, but as a newbie I couldn't assimilate any partial answers into a final one
ring's jetty adapter does produce a standard contexthandler which I think has a mount-like thing after it started
It depends on the adapter being used. If you use the default Jetty adapter, you get back a Jetty Server object. Once you've got that, I believe you can use insertHandler
to wrap Ring's Jetty handler class in a HandlerWrapper
, and then you can use setHandler
on that wrapper to add a ServletHandler
, and then finally to use addServletWithMapping
.
So, got the Servlet
-classed object, made a org.eclipse.jetty.servlet.ServletHandler
and a org.eclipse.jetty.servlet.ServletHolder
, added the servlet to it, stopped the server, .setHandler
on it and restarted. The insertHandler
I imagine will both make it ergonomic to keep the original handler and not have to restart but I didn't experiment that far yet, just saw that the above was working
Any reason the library Ring JSON/0.5.1 is not updated with ring-core currently used version is 1.9.2 ring-headers/0.3.0 is not updated with ring-core currently used version is 1.6.0
They just haven't been updated yet.
I guess once Ring 1.11 has been released I can go through and update them. But why does it matter? If you're using those libraries presumably you also have a Ring dependency in your project anyway, and that will override the older dependencies in those libraries.