Map stripes filter to handle FORWARD requests

  <filter-mapping>
        <filter-name>StripesFilter</filter-name>
        <url-pattern>*.action</url-pattern>
        <dispatcher>REQUEST</dispatcher>
        <dispatcher>FORWARD</dispatcher>
    </filter-mapping>

________________________________
From: Simon [mailto:[email protected]]
Sent: Wednesday, April 01, 2009 12:34 PM
To: Stripes Users List
Subject: [Stripes-users] ActionBean to handle servlet error page

Hi there,

I would like that Stripes handle unexpected exception in my Web Application. To 
achieve this I put the following configuration in the web.xml :

    <error-page>
        <error-code>500</error-code>
        <location>/error.url</location>
    </error-page>

When an unexpected exception happens the servlet container correctly forward 
the original request to /error.url.

However, as this is a FORWARD request, the Stripes Filter is not applied. And 
the DispatcherServlet throw the exception :

java.lang.IllegalStateException: A request made it through to some part of 
Stripes without being wrapped in a StripesRequestWrapper. The StripesFilter is 
responsible for wrapping the request, so it is likely that either the 
StripesFilter is not deployed, or that its mappings do not include the 
DispatcherServlet _and_ *.jsp. Stripes does not require that the Stripes 
wrapper is the only request wrapper, or the outermost; only that it is present.

This seems quite logical as I configured the Stripes Filter/Dispatcher in the 
web.xml like this :

    <servlet>
        <servlet-name>stripes-dispatcher</servlet-name>
        
<servlet-class>net.sourceforge.stripes.controller.DispatcherServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>

    <servlet-mapping>
        <servlet-name>stripes-dispatcher</servlet-name>
        <url-pattern>*.url</url-pattern>
    </servlet-mapping>

    <filter>
        <display-name>stripes-filter</display-name>
        <filter-name>stripes-filter</filter-name>
        
<filter-class>net.sourceforge.stripes.controller.StripesFilter</filter-class>
    </filter>

    <filter-mapping>
        <filter-name>stripes-filter</filter-name>
        <servlet-name>stripes-dispatcher</servlet-name>
    </filter-mapping>

As my Web Application does not access JSP files directly (everything goes 
through action beans) I omit the url-mapping *.jsp for the Stripes Filter.

Do you have any solution that may help me ?

Thank you,

Simon

PS : I'm using Stripes 1.5.1 and the Maven Jetty plugin
------------------------------------------------------------------------------
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to