简体   繁体   English

JEE Rest Endpoint配置是否会超过JSF的控制流程?

[英]JEE does Rest Endpoint config overtake flow of control from JSF?

In JEE as described by the oracle docs , the container to which the application is deployed will generally intercept client requests and based on the application configuration route them to a component living in the web tier, (JSF, Servlet, JSP, Rest Endpoint). 在oracle docs所描述的JEE中,部署应用程序的容器通常将拦截客户端请求,并根据应用程序配置将其路由到位于Web层中的组件(JSF,Servlet,JSP,Rest Endpoint)。

The below diagram illustrates the relationship fairly well. 下图很好地说明了这种关系。 https://docs.oracle.com/javaee/7/tutorial/webapp001.htm https://docs.oracle.com/javaee/7/tutorial/webapp001.htm

If we are implementing a rest configuration using rest endpoints, according to oracle, those rest endpoints are "web components", therefore the container will route user requests, say for example index/users/1 to a rest endpoint for the users with a query param of 1 for an id. 根据oracle,如果我们使用REST端点实现REST配置,则这些REST端点是“ Web组件”,因此容器会将用户请求(例如index / users / 1)路由到带有查询的用户的REST端点参数1的ID。

How does this then integrate with another web component such as JSF? 然后如何与其他Web组件(例如JSF)集成? Does the rest endpoint configuration essentially hijack the routing to JSF? 其余端点配置是否实质上劫持了到JSF的路由? Is the rest endpoint also responsible for including a specific view component in it's http response to the client? 其余端点还负责在对客户端的http响应中包括特定的视图组件吗? I was under the impression that in SOA the rest end point merely provides a service to retrieve data based on a restful state, to present to the current model for the current view. 我给人的印象是,在SOA中,其余端点仅提供一种服务,用于基于静态状态检索数据,并提供给当前视图的当前模型。

For example , in my interpretation it should be something like this instead. 例如,按照我的解释,它应该是这样的。

Client Request ----> JSF servlet------>call rest endpoint
Gets new page  <-- Update Model <-------end point talks to DB and returns data
           and spit out new html page

Am I misinterpreting what the oracle docs are saying specifically when they include the rest configuration as a web component? 当他们将其余配置作为Web组件包括在内时,我是否会误解oracle文档在说什么?

In your web.xml you can set up different deployment descriptors for the different components. 在web.xml中,您可以为不同的组件设置不同的部署描述符。 So you can have requests routed to different components based on the root context. 因此,您可以基于根上下文将请求路由到不同的组件。 Eg www.site.com/rest/service can be routed to a rest API based on the context of "/rest" and you could have other requests routed to your JSF servlet with a context of /faces". 例如,可以基于“ / rest”的上下文将www.site.com/rest/service路由到rest API,并且您可以使用/ faces上下文将其他请求路由到您的JSF servlet。

This link explains it pretty well. 该链接对此进行了很好的解释。

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

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