RESTful 后端 (JSON)
我有一个关于 RESTful 客户端实施的问题。
目前我已经使用RESTeasy和EJB开发了服务器。方法在很多情况下返回 JSON。现在我们开始后端开发(WEB)。并且无法为此选择一个支持授权、身份验证的框架...
您能否建议一种模式、框架、方法等...
I have a question regarding RESTful client implementation.
At this moment I have developed the server using RESTeasy and EJB. Method return JSON in much case. And now we are starting backend development(WEB). And can't select a framework for this, that supports authorization, authentication...
Could you suggest a pattern, framework, approach etc..
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您正在寻找适合您现有技术 (EJB) 的 Java Web 框架,您应该考虑一下 JSF 和 WebBeans(请注意,JSF 不会为其操作/控制器公开 RESTful URL)。
然而,既然您还提到了 REST,我想您只是想要一个可以处理用户安全和身份验证的服务后端框架。在这种情况下,您应该看看 spring(特别是 spring-security 和 spring-web)。大多数 JAX-RS 实现都对 Spring 有良好的支持,尽管我应该提到 Spring 本身有一个出色的 REST 框架,它与其他产品配合得很好。
另一方面,如果您想要一个能够在公开 RESTful 服务的 EJB 应用程序上下文中处理安全性的框架,那么您就陷入了困境。 RESTful 应用程序旨在将大部分状态保留在客户端,这与大多数经常使用全状态会话 bean 的 EJB 应用程序不同。您可以将 JAX-RS 与无状态或单例 EJB 集成,然后使用 spring-security 来处理安全性/身份验证,或者使用 web.xml 中的
,如 此处If you looking for a Java web framework that fits your existing technology (EJB) you should take a look at JSF and WebBeans (note though that JSF does not expose RESTful URLs for its actions/controllers).
However since you also mentioned REST I guess you just want a backend framework for your services that can handle user security and auth. In this case you should take a look at spring (in particular spring-security and spring-web). Most JAX-RS implementations have good support for spring, although I should mention that spring itself has a splendid REST framework that of cause works very well with their other offerings.
If on the other hand you want a framework that can handle security in the context of a EJB application that exposes a RESTful service, then you are in a tough spot. RESTful applications are meant to keep most of the state at the client, in contrast to most EJB apps that frequently uses state-full session beans. You can integrate JAX-RS with stateless or singleton EJBs and then either use spring-security to handle the security/auth or use the
<security-constraint>
in the web.xml as described here