简体   繁体   English

在EAR文件中获取REST资源路径

[英]Getting REST Resource path in EAR file

I have an EJB project which contains a Rest Web Service EJB. 我有一个包含Rest Web Service EJB的EJB项目。 I package this EJB.jar project into an EAR file along with a WAR project. 我将此EJB.jar项目与WAR项目一起打包到EAR文件中。 What would be the absolute path of my Rest Web Service then? 那么我的Rest Web Service的绝对路径是什么呢?

My problem seems to be due to the fact that the EJB JAR file containing the EJB REST Web Service is packaged in an EAR file alongside a WAR file. 我的问题似乎是由于包含EJB REST Web服务的EJB JAR文件与WAR文件一起打包在EAR文件中。 I've read that you can use JAX-RS within an EJB JAR file but what I wasn't aware of was that this JAR file has to then be packaged within the WEB-INF/lib folder in a Dynamic Web Project (WAR file). 我已经读过你可以在EJB JAR文件中使用JAX-RS,但我不知道的是,这个JAR文件必须打包在Dynamic Web Project(WAR文件)中的WEB-INF / lib文件夹中)。 According to this link, it is not supported for JAX-RS EJB's to be included in an EAR file. 根据此链接, JAX-RS EJB不支持包含在EAR文件中。

Glad that you've already found an answer. 很高兴你已经找到了答案。
From my perspective, exposing stateless EJB beans as restfull services is fast, but typically isn't the best approach. 从我的角度来看,将无状态EJB bean暴露为restfull服务的速度很快,但通常不是最好的方法。

Usually, it is better to create restfull endpoint classes in a web module that wraps errors/ exceptions coming from ejb services. 通常,最好在包含来自ejb服务的错误/异常的Web模块中创建restfull端点类。 This is also a good place to do some translations etc. 这也是做翻译等的好地方。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM