Here's the Javadoc for DMF:

A servlet filter that dynamically maps URLs to ActionBeans. This filter can
be used to allow Stripes to dispatch requests to ActionBeans based on their
URL binding, even if the URL to which they are bound is not explicitly
mapped in web.xml.

There are a few caveats that must be observed when using this filter:

   - StripesFilter *MUST* be defined in web.xml so that it will be loaded
   and initialized.
   - This filter *MUST* be mapped to /* to work correctly.
   - This filter *MUST* be the last filter in the filter chain. When it
   dynamically maps an ActionBean to a URL, the filter chain is interrupted.

 StripesFilter and DispatcherServlet need not be mapped to any URL patterns
in web.xml since this filter will determine at runtime whether or not they
need to be invoked. In fact, you don't even need to define DispatcherServletin
web.xml at all because this filter uses an instance it creates and manages
internally. However, some resources, such as JSPs, may require access to the
Stripes Configuration. Thus, StripesFilter should be mapped to *.jsp if you
intend to access JSPs directly.

This filter takes the following approach to determining when to dispatch an
ActionBean:

   1. Allow the request to process normally, trapping any HTTP errors that
   are returned.
   2. If no error was returned then do nothing, allowing the request to
   complete successfully. If any error other than 404 was returned then send
   the error through. Otherwise ...
   3. Check the ActionResolver to see if an ActionBean is mapped to the URL.
   If not, then send the 404 error through. Otherwise...
   4. Invoke StripesFilter and DispatcherServlet

 One benefit of this approach is that static resources can be delivered from
the same namespace to which an ActionBean is mapped using clean URLs. (Form
more information on clean URLs, see UrlBinding.) For example, if your
UserActionBean is mapped to @UrlBinding("/user/{id}/{$event}") and you have
a static file at /user/icon.gif, then your icon will be delivered correctly
because the initial request will not have returned a 404 error.

This filter accepts one init-param. IncludeBufferSize (optional, default
1024) sets the number of characters to be buffered by
DynamicMappingFilter.TempBufferWriter for include requests. See
DynamicMappingFilter.TempBufferWriter for more information.

This is the suggested mapping for this filter in web.xml.

  <filter>
      <description>Dynamically maps URLs to ActionBeans.</description>
      <display-name>Stripes Dynamic Mapping Filter</display-name>
      <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>



On Fri, Jul 11, 2008 at 12:12 PM, David G Friedman <[EMAIL PROTECTED]>
wrote:

>  So what happens after that?  A Dynamic pass-through to the default system
> handler in case of no matching URL or some Stripes JSP handler?
>
> -David
>
> Aaron Porter wrote:
>
> Sorry, missed a bit. Here's everything you need:
>
>     <filter>
>         <description>Dynamically maps URLs to ActionBeans.</description>
>         <display-name>Stripes Dynamic Mapping Filter</display-name>
>         <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>
>
>
-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to