Jersey with Struts2 [duplicate]

房东的猫 提交于 2019-11-26 19:11:44
Aleksandr M

With this configuration Struts2 filter intercepts all requests.

To exclude your /service/* requests use struts.action.excludePattern constant:

<constant name="struts.action.excludePattern" value="/service/.*" />
user2193014

I have a similar architecture (using Struts2 and Jersey).

In my web.xml I have:

<filter>
    <filter-name>struts2</filter-name>
    <filter-class>
        org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
    </filter-class>
</filter>

<filter-mapping>
    <filter-name>struts2</filter-name>
    <url-pattern>/admin/*</url-pattern>
</filter-mapping>

My Jersey is configured through an extended ResourceConfig:

@ApplicationPath("rest")
public class Config extends ResourceConfig {

    public Config() {
        super();
        register(new Binder());
        packages(true, this.getClass().getPackage().getName());
    }

}

So the two are on separate url paths:

Struts is on /admin and Jersey is on /rest.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!