是否可以从ring/compojure调用java servlet?

发布于 2024-12-02 04:04:39 字数 220 浏览 0 评论 0原文

我必须从 Clojure Web 应用程序调用用 Java 编写的 servlet,但我不明白该怎么做。

使用 Java 开发 Web 应用程序时,我必须在 web.xml 中描述所有映射。我明白,在 Compojure 中,我必须描述路线。那么,我可以将 Java servlet 绑定到这样一个路由吗?

抱歉,如果我的问题很愚蠢,但我已经搜索了很多,但没有找到答案;我刚刚开始进行网络开发。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

眼泪淡了忧伤 2024-12-09 04:04:39

两个有用的提示:

github

这里有一个关于 如何将 java 过滤器映射到路由

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

薄荷梦 2024-12-09 04:04:39

我建议,只有一种方法可以完成我的任务。我必须在 Clojure Web 应用程序中手动实例化 Java servlet 并形成它们的请求和响应参数。 测试包 ring.util.servlet 库详细描述了这种方法,但是将 Ring 处理程序转换为 Java servlet 的情况。

如果将 Clojure 应用程序和 Java servlet 分别部署到 servlet 容器,则无需为容器映射的路径定义额外的 Compojure 路由或 Ring 处理程序。

请告诉我我的建议是否正确。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文