Spring MVC:RESTful Web 服务 + BlazeDS 可以集成在同一个 Web 应用程序中吗?
我有一个 Spring MVC Web 应用程序,它通过控制器类(用 @Controller 注释)提供 RESTful Web 服务,该类具有通过 @RequestMapping 注释映射到特定请求类型和签名的方法。
我尝试通过以下方式将 BlazeDS 服务目标集成到组合中:1)将 HttpFlexSession 侦听器添加到 web.xml,2)将 flex:message-broker 和 flex:remoting-destination 声明添加到我的 Spring 应用程序上下文配置文件中,以及3)添加通用/WEB-INF/flex/services-config.xml。
上述 BlazeDS 集成步骤似乎已经限制了我的 RESTful Web 服务,因为请求似乎不再路由到控制器方法。
是否有可能做到这一点,即拥有一个 Web 应用程序,1)通过请求映射控制器方法为 HTTP 请求提供服务,2)通过 BlazeDS 服务为远程对象方法调用(即来自 Flex 客户端)提供服务?如果是这样,那么我做错了什么?
I have a Spring MVC web application which provides RESTful web services via a controller class (annotated with @Controller) which has methods mapped to specific request types and signatures via @RequestMapping annotations.
I have attempted to integrate a BlazeDS service destination into the mix by 1) adding the HttpFlexSession listener to the web.xml, 2) adding the flex:message-broker and flex:remoting-destination declarations to my Spring application context configuration file, and 3) adding a generic /WEB-INF/flex/services-config.xml.
The above BlazeDS integration steps appear to have hosed my RESTful web services, in that it appears that requests are no longer being routed to the controller methods.
Is it even possible to do this, i.e, to have a single web application which 1) services HTTP requests via request mapped controller methods and 2) services remote object method calls (i.e. from a Flex client) via a BlazeDS service? If so then what might it be that I'm doing wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的,这是可能的,但它需要一些额外的配置。
本质上,您需要创建两个单独的调度程序,每个调度程序都有不同的路径。
现在,对 http://yourapp/app/somewhere 的请求将路由到 Spring MVC,对 http://yourapp/messagebroker 通过 BlazeDS 路由。
此外,您还需要将 Spring 上下文文件分成三个:
applicationContext.xml
)spring-mvc-servlet上例中的 .xml
)flex-servlet.xml
)查看 Spring/BlazeDS 文档中的此部分了解更多信息。
Yes, it's possible, but it requires a little extra configuration.
Essentially you need to create two seperate dispatchers, each with a different path.
Now requests to http://yourapp/app/somewhere are routed to Spring MVC, and requests to http://yourapp/messagebroker are routed through BlazeDS.
Also, you'll need to split out your spring context files into three:
applicationContext.xml
in the above example)spring-mvc-servlet.xml
in the above example)flex-servlet.xml
in the above example)Check out this section from the Spring/BlazeDS docs for more info.