Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用SpringMVC的RESTEasy异步HTTP_Spring_Http_Rest_Asynchronous_Resteasy - Fatal编程技术网

使用SpringMVC的RESTEasy异步HTTP

使用SpringMVC的RESTEasy异步HTTP,spring,http,rest,asynchronous,resteasy,Spring,Http,Rest,Asynchronous,Resteasy,是否有任何方便的方法将RESTEasy异步HTTP支持(在我的Tomcat6上)与SpringMVC框架结合使用。我已经找到了关于在Spring中使用RESTEasy的有用文章,但是没有一篇文章涉及异步支持,这在目前看来有点棘手,因为根据容器(例如Tomcat6CometDispatcherServlet for Tomcat)重新请求不同的Servlet类 谢谢, FB我使用Comet、Bayeux、Java、Maven和Raphael JS前端创建了一个示例应用程序,并写了一篇关于它的博客文

是否有任何方便的方法将RESTEasy异步HTTP支持(在我的Tomcat6上)与SpringMVC框架结合使用。我已经找到了关于在Spring中使用RESTEasy的有用文章,但是没有一篇文章涉及异步支持,这在目前看来有点棘手,因为根据容器(例如Tomcat6CometDispatcherServlet for Tomcat)重新请求不同的Servlet类

谢谢,
FB

我使用Comet、Bayeux、Java、Maven和Raphael JS前端创建了一个示例应用程序,并写了一篇关于它的博客文章,您可以将它用作应用程序的基础,只需在REST中包装当前的服务代码


希望它能对您有所帮助。

对于任何感兴趣的人来说,我最终不得不使用Tomcat6CometDispatcherServlet而不是Spring DispatcherServlet来让我的应用程序正常工作

我仍然有Spring ContextLoaderListener,可以在我的应用程序上下文中创建各种bean,但是必须使用不太理想的方法从我的控制器类中访问这些bean,这些控制器类现在是JAX-RS注释的,而不是Spring MVC注释的。(快速谷歌将在以编程方式访问Spring上下文时发现各种文章。)

这里是我的web.xml的一个清理版本(没有什么惊天动地的东西,但也许它会给某些人一些有用的提示!):


myapp
我的应用程序
log4jConfigLocation
类路径:log4j.properties
WebApprotKey
myapp.root
上下文配置位置
类路径:applicationContext.xml
轻松扫描
真的
信任过滤器
org.springframework.web.filter.DelegatingFilterProxy
信任过滤器
/*
URL重写过滤器
org.tuckey.web.filters.urlrewrite.UrlRewriteFilter
URL重写过滤器
/*
org.springframework.web.util.Log4jConfigListener
org.springframework.web.context.ContextLoaderListener
PollServlet
org.jboss.resteasy.plugins.server.servlet.Tomcat6CometDispatcherServlet
PollServlet
/民意测验/*
index.jsp
java.lang.Exception
/WEB-INF/jsp/uncaughtException.jsp

谢谢菲利佩。我看了一下,但看不到如何访问应用程序的任何源。。。
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.4" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>myapp</display-name>
<description>My App</description>

    <context-param>
        <param-name>log4jConfigLocation</param-name>
        <param-value>classpath:log4j.properties</param-value>
    </context-param>

    <context-param>
        <param-name>webAppRootKey</param-name>
        <param-value>myapp.root</param-value>
    </context-param>

    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>classpath:applicationContext.xml</param-value>
    </context-param>

    <context-param>
        <param-name>resteasy.scan</param-name>
        <param-value>true</param-value>
    </context-param>

    <filter>
       <filter-name>TrustedIPFilter</filter-name>
       <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>TrustedIPFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

    <filter>
        <filter-name>UrlRewriteFilter</filter-name>
        <filter-class>org.tuckey.web.filters.urlrewrite.UrlRewriteFilter</filter-class>
    </filter>    
    <filter-mapping>
        <filter-name>UrlRewriteFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>    

    <listener>
        <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
    </listener>

    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>

    <servlet>
       <servlet-name>PollServlet</servlet-name>
       <servlet-class>org.jboss.resteasy.plugins.server.servlet.Tomcat6CometDispatcherServlet</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>PollServlet</servlet-name>
        <url-pattern>/poll/*</url-pattern>
    </servlet-mapping>

    <welcome-file-list>
        <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>

    <error-page>
        <exception-type>java.lang.Exception</exception-type>
        <location>/WEB-INF/jsp/uncaughtException.jsp</location>
    </error-page>

</web-app>