Resteasy and Struts 2 - Interceptor Problem

Asked

Viewed 76 times

0

My project uses Wildfly 8, java 8 with Struts 2. I’m trying to use Resteasy to implement web services. The project works perfectly, but when I include the settings for Resteasy in the web.xml, Struts 2’s Interceptor stops working. The Resteasy settings are at the end of web.xml below:

        <?xml version="1.0" encoding="UTF-8"?>
    <web-app version="2.5" 
        xmlns="http://java.sun.com/xml/ns/javaee" 
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
        xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
        http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">

        <display-name>Sistema Academico</display-name>

        <filter>
            <filter-name>ResponseOverrideFilter</filter-name>     
            <filter-class>org.displaytag.filter.ResponseOverrideFilter</filter-class>
        </filter>

        <filter>
            <filter-name>struts-cleanup</filter-name>
            <filter-class>org.apache.struts2.dispatcher.ActionContextCleanUp</filter-class>
        </filter>

        <filter>
            <filter-name>struts</filter-name>
            <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
        </filter>

        <filter-mapping>
            <filter-name>ResponseOverrideFilter</filter-name>
            <url-pattern>*.action</url-pattern>
        </filter-mapping>

        <filter-mapping>
            <filter-name>ResponseOverrideFilter</filter-name>
            <url-pattern>*.jsp</url-pattern>
        </filter-mapping>   

        <filter-mapping>
            <filter-name>struts-cleanup</filter-name>
            <url-pattern>/*</url-pattern>
        </filter-mapping>

        <filter-mapping>
            <filter-name>struts</filter-name>
            <url-pattern>/*</url-pattern>
        </filter-mapping>

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

        <listener>
            <listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
        </listener>

        <listener>
            <listener-class>br.com.common.utils.SessionListener</listener-class>
        </listener>

        <context-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>/WEB-INF/applicationContext.xml</param-value>
        </context-param>


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

        <session-config>
          <session-timeout>20</session-timeout> 
        </session-config>

   <!-- RESTEasy: mapeie "TODOS" meus recursos JAX-RS -->  
   <context-param>  
      <param-name>resteasy.scan</param-name>  
      <param-value>true</param-value>  
   </context-param>  

   <!-- O Servlet do RESTeasy pega as requests para direcionar para as suas   
      classes JAX-RS -->  
   <servlet>  
      <servlet-name>Resteasy</servlet-name>  
      <servlet-class>org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher</servlet-class>  
   </servlet>  

   <!-- O servlet do RESTEasy responde na raiz da aplicação -->  
   <servlet-mapping>  
      <servlet-name>Resteasy</servlet-name>  
      <url-pattern>/*</url-pattern>  
   </servlet-mapping>  

    </web-app>

Is it possible to use Resteasy with Struts2? Can anyone point out where I’m missing?

Thank you

  • I changed the Resteasy Mapping to /rs/*. Now the application is working again, but the webservice is not available.

  • When trying to consume the webservice, I get the message There is no Action Mapped for namespace / and action name obtemAlunos.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.