是否可以将EJB项目公开为RESTful WS?(Is it possible to expose an EJB project as a RESTful WS?)

编程入门 行业动态 更新时间:2024-10-24 00:30:11
是否可以将EJB项目公开为RESTful WS?(Is it possible to expose an EJB project as a RESTful WS?)

我使用jersey实现了RESTful Web服务并将其部署在Tomcat上,我使用DAO类来操作数据库操作,实体包装数据库记录。 并在单独的包中进行处理。 我想使用EJB分发这个系统。 首先,做这个改变会很容易。 或者我需要从头开始重写。 其次,我仍然需要拥有REST WS,那么是否可以将EJB公开为REST WS以及如何? REST WS是在同一个EJB项目中还是在另一个项目中?

I have implemented a RESTful web service using jersey and deployed it on Tomcat, I have used DAO classes to manipulate database operations, entities to wrap database records. and did the processing in separate package. I want to make this system distributed using EJB. First of all would it be easy to do this change. or i need to rewrite things from scratch. Second, I still need to have the REST WS, so would it be possible to expose the EJB as a REST WS and how? would the REST WS be in the same EJB project or in a different one?

最满意答案

您绝对可以将其作为EJB和REST WS来实现。 将Tomcat安装升级到TomEE Plus ,然后将@Stateless或@Singleton添加到现有REST服务。

由于Java EE版本的Tomcat(TomEE)包含用于JAX-RS支持的CXF,因此您不再需要Jersey。

此示例没有详细记录,但显示了一个结合了EJB和JAX-RS的功能应用程序。

http://tomee.apache.org/examples-trunk/rest-on-ejb/README.html

You can definitely do it as an EJB and REST WS. Upgrade your Tomcat install to TomEE Plus, then just add @Stateless or @Singleton to the existing REST service.

You won't need Jersey in there anymore as the Java EE version of Tomcat (TomEE) includes CXF for JAX-RS support.

This example is not well documented, but shows a functional application that combines both EJB and JAX-RS.

http://tomee.apache.org/examples-trunk/rest-on-ejb/README.html

更多推荐

本文发布于:2023-08-06 05:20:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1444790.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:项目   RESTful   EJB   project   expose

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!