REST在不同的war文件中使用几个resteasy提供程序

时间:2015-01-22 11:59:19

标签: rest java-ee servlets resteasy

在部署的EAR文件中,有几个WAR配置其他提供程序。

file1.war:

<context-param>
    <param-name>resteasy.providers</param-name>
    <param-value>
        path1.exception.Mapper1
    </param-value>
</context-param>

<listener>
    <listener-class>org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap</listener-class>
</listener>

<servlet>
    <servlet-name>Resteasy</servlet-name>
    <servlet-class>org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher</servlet-class>
</servlet>

<servlet-mapping>
    <servlet-name>Resteasy</servlet-name>
    <url-pattern>/rest/path1</url-pattern>
</servlet-mapping>

file2.war:

   <context-param>
        <param-name>resteasy.providers</param-name>
        <param-value>
            path2.exception.Mapper2
        </param-value>
    </context-param>
    <listener>
        <listener-class>org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap</listener-class>
    </listener>

现在,当使用/rest/path2网址时,会调用path1.exception.Mapper1,但只应使用path2.exception.Mapper2。 我该如何存档?

我尝试在file1.war的web.xml中使用:

<context-param>
    <param-name>resteasy.servlet.mapping.prefix</param-name>
    <param-value>/rest/path1/* </param-value>
</context-param>
<servlet-mapping>
    <servlet-name>Resteasy</servlet-name>
    <url-pattern>/rest/path1</url-pattern>
</servlet-mapping>

没有成功(当尝试访问/ rest / path2 url时,path1.exception.Mapper1捕获并工作)。 有什么想法吗?

0 个答案:

没有答案