Spring, Jersey and Viewable JSP Integration

Posted by Brian D. on Stack Overflow See other posts from Stack Overflow or by Brian D.
Published on 2010-12-30T03:57:13Z Indexed on 2010/12/31 22:53 UTC
Read the original article Hit count: 435

Filed under:
|
|
|

I'm trying to integrate Spring 3.0.5 with Jersey 1.4. I seem to have everything working, but whenever I try and return a Viewable that points to a JSP, I get a 404 error. When I wasn't using spring I could use this filter:

<filter>
    <filter-name>Jersey Filter</filter-name>
    <filter-class>com.sun.jersey.spi.container.servlet.ServletContainer</filter-class>
    <init-param>
        <param-name>com.sun.jersey.config.feature.Redirect</param-name>
        <param-value>true</param-value>
    </init-param>
    <init-param>
        <param-name>com.sun.jersey.config.property.packages</param-name>
        <param-value>cheetah.frontend.controllers</param-value>
    </init-param>
    <init-param>
        <param-name>com.sun.jersey.config.feature.FilterForwardOn404</param-name>
        <param-value>true</param-value>
    </init-param>
    <init-param>
        <param-name>com.sun.jersey.config.property.WebPageContentRegex</param-name>
        <param-value>/(images|css|jsp)/.*</param-value>
    </init-param>
</filter>

And I could return a Viewable to any JSP's, image, css that were stored in the appropriate folder. However, now that I have to use the SpringServlet to get spring integration, I'm at a loss for how to access resources, since I can't use the filter above. I've tried using this servlet mapping with no luck:

<servlet>  
    <servlet-name>jerseyspring</servlet-name> 
    <servlet-class>com.sun.jersey.spi.spring.container.servlet.SpringServlet</servlet-class>  
    <load-on-startup>1</load-on-startup>
    <init-param>
        <param-name>com.sun.jersey.config.property.WebPageContentRegex</param-name>
        <param-value>/(images|css|jsp)/.*</param-value>
    </init-param>
</servlet>  
<servlet-mapping>  
    <servlet-name>jerseyspring</servlet-name>  
    <url-pattern>/*</url-pattern>  
</servlet-mapping>

Does anyone know the proper configurations to achieve this?

Thanks for any help.

© Stack Overflow or respective owner

Related posts about java

Related posts about spring