You can't bind to "/" using DMF because DMF operates by allowing the request
to go through and then looking for a 404 from the container before it
forwards to the ActionBean (if one is bound to the requested path).
Therefore, if you bind to "/" *all* of your 404 errors will get routed
through your ActionBean instead of the error handler you've configured. So
yes, you should add a "/index.jsp" that forwards to your ActionBean, which
is bound to something other than "/".
-Ben
On Sun, Oct 2, 2011 at 9:01 AM, Chris Molozian <ch...@cmoz.me> wrote:
> Hey all,
>
> You might have seen me on the IRC channel asking about this. I'm quite
> confused about how to configure the DynamicMappingFilter and how it fits
> together with StripesDispatcher and StripesFilter. I've searching around
> online and there are many slightly different configurations that are
> "recommended".
>
> I'd like to achieve the following:
>
> - HomeBean.java uses UrlBinding("/") to match requests for the home
> page.
> - LoginBean.java uses UrlBinding("/login")
> - Any requests that do not match a binding reach a 404 page, I've
> created a /WEB-INF/jsp/404.jsp .
>
> The web.xml I've configured so far is:
> ------------------------------
> <?xml version="1.0" encoding="UTF-8"?>
> <web-app
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"<http://www.w3.org/2001/XMLSchema-instance>
>
> xmlns="http://java.sun.com/xml/ns/javaee"<http://java.sun.com/xml/ns/javaee>
>
> xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"<http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd>version="2.5">
>
> <filter>
> <filter-name>StripesFilter</filter-name>
>
> <filter-class>net.sourceforge.stripes.controller.StripesFilter</filter-class>
> <init-param>
> <param-name>ActionResolver.Packages</param-name>
> <param-value>com.webapp.action</param-value>
> </init-param>
> <init-param>
> <param-name>Extension.Packages</param-name>
> <param-value>com.webapp.ext</param-value>
> </init-param>
> </filter>
>
> <filter>
> <filter-name>DynamicMappingFilter</filter-name>
>
> <filter-class>net.sourceforge.stripes.controller.DynamicMappingFilter</filter-class>
> </filter>
>
> <filter-mapping>
> <filter-name>DynamicMappingFilter</filter-name>
> <url-pattern>/*</url-pattern>
> <dispatcher>REQUEST</dispatcher>
> <dispatcher>FORWARD</dispatcher>
> <dispatcher>INCLUDE</dispatcher>
> </filter-mapping>
>
> <welcome-file-list>
> <welcome-file>index.jsp</welcome-file>
> </welcome-file-list>
>
> <error-page>
> <error-code>404</error-code>
> <location>/WEB-INF/jsp/404.jsp</location>
> </error-page>
>
> </web-app>
> ------------------------------
>
>
>
> I have the following questions:
>
> - Do I need an index.jsp that forwards requests to the HomeBean ?
> Couldn't the UrlBinding simply handle the Url request?
> - At the moment any url pattern e.g. /testme requests are handled by
> the HomeBean apart from /login. My 404 handler is never being used ?
>
> I'd like to follow idiomatic practices when using Stripes all help is
> appreciated.
>
> Kind Regards,
>
> Chris
>
>
>
> ------------------------------------------------------------------------------
> All of the data generated in your IT infrastructure is seriously valuable.
> Why? It contains a definitive record of application performance, security
> threats, fraudulent activity, and more. Splunk takes this data and makes
> sense of it. IT sense. And common sense.
> http://p.sf.net/sfu/splunk-d2dcopy2
> _______________________________________________
> Stripes-users mailing list
> Stripes-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/stripes-users
>
>
------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security
threats, fraudulent activity, and more. Splunk takes this data and makes
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2dcopy2
_______________________________________________
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users