0

Spring MVC フレームワークと組み合わせて RESTEasy 非同期 HTTP サポート (私の場合は Tomcat 6) を使用する便利な方法はありますか? Spring での RESTEasy の使用に関する有用な記事を見つけましたが、コンテナーに応じて異なるサーブレット クラス (Tomcat の Tomcat6CometDispatcherServlet など) を必要とするため、現時点では少しとげがあるように見える非同期サポートをカバーする記事はありません。 .

ありがとう、FB

4

2 に答える 2

0

Comet、Bayeux、Java、Maven、Raphael JSフロントエンドを使用してサンプルアプリを作成し、それに関するブログ投稿を作成しました。現在のサービスコードをRESTでラップするだけで、アプリのベースとして使用できます。

http://geeks.aretotally.in/thinking-in-reverse-not-taking-orders-from-yo

うまくいけば、それはあなたを助けるでしょう。

于 2011-02-22T16:31:02.163 に答える
0

興味のある方は、アプリケーションを機能させるために、Spring DispatcherServlet の代わりに Tomcat6CometDispatcherServlet を使用する必要がありました。

Application Context 内にさまざまな Bean を作成するための Spring ContextLoaderListener がまだ用意されていますが、Spring MVC アノテーションではなく JAX-RS アノテーションが付けられた Controller クラス内からこれらにアクセスするためには、理想的とは言えない手段を使用する必要があります。(プログラムによる Spring コンテキストへのアクセスについて、Google が簡単に明らかにするさまざまな記事があります。)

これは私の web.xml のクリーンアップされたバージョンです (驚くべきことは何もありませんが、おそらく誰かにとって役立つヒントがあるでしょう!):

<?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>
于 2011-07-01T09:46:10.113 に答える