Dashboard > Stripes > ... > How To's > Extensions
Extensions Log In | Sign Up   View a printable version of the current page.

Added by Frederic Daoud , last edited by Frederic Daoud on Jul 28, 2008  (view change)

Extensions - how to extend and customize Stripes

Beginning with Stripes 1.5, you can configure one or more packages in web.xml from which Stripes will automatically load all extensions. Extensions include:

In web.xml, add an initialization parameter to StripesFilter called Extension.Packages. Each package that you indicate automatically includes all sub-packages, so do not use .*. For example,

web.xml
<filter>
  <display-name>Stripes Filter</display-name>
  <filter-name>StripesFilter</filter-name>
  <filter-class>net.sourceforge.stripes.controller.StripesFilter</filter-class>
  <init-param>
    <param-name>ActionResolver.Packages</param-name>
    <param-value>net.sourceforge.stripes.examples</param-value>
  </init-param>
  <init-param>
    <param-name>Extension.Packages</param-name>
    <param-value>net.sourceforge.stripes.extensions</param-value>
  </init-param>
</filter>

Now you can drop in Stripes extensions to net.sourceforge.stripes.extensions and its subpackages, and they will automatically be loaded. You can also use more than one package root by separating the packages with commas:

web.xml
<filter>
  <display-name>Stripes Filter</display-name>
  <filter-name>StripesFilter</filter-name>
  <filter-class>net.sourceforge.stripes.controller.StripesFilter</filter-class>
  <init-param>
    <param-name>ActionResolver.Packages</param-name>
    <param-value>net.sourceforge.stripes.examples</param-value>
  </init-param>
  <init-param>
    <param-name>Extension.Packages</param-name>
    <param-value>net.sourceforge.stripes.extensions, another.pkg.extensions</param-value>
  </init-param>
</filter>

If you have a class in an extension package and want to tell Stripes not to automatically load it, you don't have to move the class to another package. You can simply annotate the class with @DontAutoLoad.

Hosting for this site is donated by the wonderful people at Contegix
Site running on a free Atlassian Confluence Open Source Project License granted to Stripes Framework. Evaluate Confluence today.
Powered by Atlassian Confluence, the Enterprise Wiki. (Version: 2.6.2 Build:#919 Nov 26, 2007) - Bug/feature request - Contact Administrators