Lexx Cherry
Lexx Cherry

Reputation: 51

is it possible to call java servlet from ring/compojure?

I have to call a servlet written in Java from Clojure web application, and I don't understand how to do that.

Developing a webapp in Java, I had to describe all mappings in web.xml. In Compojure, I see, I must describe routes. So, can I bind the Java servlet to one such route?

Sorry if my question is stupid, but I've searched a lot and didn't find an answer; I'm just starting to develop for the web.

Upvotes: 5

Views: 1015

Answers (2)

Lexx Cherry
Lexx Cherry

Reputation: 1

I suggest, there is only one way to cope with my tasks. I have to manually instantiate Java servlets in Clojure web app and form their request and response parameters. Test package for ring.util.servlet library describes this approach in details, but in case of turning Ring handler into a Java servlet.

In case of deploying Clojure app and Java servlets to servlet container separately there's no need to define additional Compojure routes or Ring handlers to paths mapped by container.

Please tell me whether my suggestions are incorrect.

Upvotes: 0

Nicolas Modrzyk
Nicolas Modrzyk

Reputation: 14197

Two helpful pointers:

There's an example on how to generate the Vaadin servlet completely from Clojure on github

And here's a SO question on how to map a java filter to routes

Upvotes: 2

Related Questions