将 WebService (JAX-RS) 与 Java Stripes 集成
我有一个用 Stripes 开发的 Web 应用程序。现在我需要在同一个应用程序中开发 RESTful Web 服务(可能使用 JAX-RS)。如何集成我的 Stripes 应用程序来包含这些 Web 服务,是否有任何可用的示例,或者除 JAX-RS 之外的任何其他方法?
I have a web application developed in Stripes. Now I need to develop RESTful webservices (probably using JAX-RS) in the same app. How do I integrate my Stripes application to contain these webservices, is there any sample available, or any other method other than JAX-RS?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
由于 Stripes 是一个 Web 应用程序框架(即主要是表示层),而 JAX-RS 是一种用于执行 RESTful Web 服务的标准(即主要是业务逻辑层),因此我很想拥有两个单独的 servlet,一个用于条纹部分和 JAX-RS 部分的一个。然后,Stripes 部分将访问其后端的 JAX-RS 部分。
可能可以将这两个部分部署在同一个容器中,但我对此没有太多经验。
(您需要尽早选择要使用的 JAX-RS 实现。我知道的是 Jersey 和 CXF,它们有足够的差异(由不同的用例集驱动),您不会想要在它们之间切换。)
As Stripes is a web application framework (i.e., mainly presentation tier) whereas JAX-RS is a standard for doing RESTful web services (i.e., mainly business logic tier), I'd be strongly tempted to have two separate servlets, one for the Stripes part and one for the JAX-RS part. The Stripes part would then access the JAX-RS part for its back-end.
It is probably possible to deploy both parts in the same container, but I've not a lot of experience with that.
(You'll want to select which JAX-RS implementation you're using fairly early. The ones I know of are Jersey and CXF, and they have enough differences — driven from different sets of use cases — that you won't want to switch between them.)
我现在也有同样的问题。 JAX-WS servlet 应该与 Stripes servlet 结合使用,这就是问题所在。
web.xml 摘录:
在这种情况下,JAX-WS servlet 正在工作,但所有其他请求都不会由 Stripes 处理。
有人对此问题有任何新的更新吗?谢谢。
更新:我发现请求是由两个 servlet 处理的,但问题是因为现在应用程序的上下文根等于 WAR 包的名称。不过,我
在 jboss-web.xml 中,它的行为符合预期,以防不包含 WebConnector servlet。一旦 WebConnector servlet 包含在 web.xml 中,上面的配置就会被忽略。
I have the same problem now. JAX-WS servlet should work in combination with Stripes servlet and here is the problem.
web.xml excerpt:
In this case JAX-WS servlet is working but all the other requests are not processed by Stripes.
Does anybody have any new updates to the issue? Thanks.
UPDATE: I have figured out that requests were processed by both servlets however the problem is because now the application has context root equal to the name of the WAR package. However I have
in jboss-web.xml and it behaves as expected in case WebConnector servlet is not included. As soon as WebConnector servlet is included in web.xml, the configuration above is ignored.