Java Reference
In-Depth Information
Stripes Extensions
Custom type converters, custom formatters, and many other
custom components are collectively known in Stripes as exten-
sions. To minimize configuration, Stripes gives you a way to set,
once and for all, the packages that contain your extensions.
Stripes automatically loads all extensions found in these pack-
ages and their subpackages. So, you can add, remove, and
rename your extensions without changing the configuration, as
long as the packages still correspond to the ones you config-
ured.
To indicate the packages for your extensions, give the Stripes
filter a value for the Extension.Packages parameter in web.xml :
Download email_07/web/WEB-INF/web.xml
<filter>
<filter-name> StripesFilter </filter-name>
<filter-class>
net.sourceforge.stripes.controller.StripesFilter
</filter-class>
<!-- ... -->
<init-param>
<param-name> Extension.Packages </param-name>
<param-value> stripesbook.ext </param-value>
</init-param>
</filter>
The Extension.Packages parameter works much like the ActionRe-
solver.Packages , except that the package roots are for exten-
sions instead of action beans. With the previous configuration,
all extensions found in stripesbook.ext or any subpackage will
automatically be loaded. You can specify several packages
by separating them with commas.
In the packages you have configured as extension packages,
you can still have no nextension classes. Stripes simply ignores
those classes during the extension autoloading process. On the
other hand, if you have an extension class in one of the exten-
sion packages and you'd like to tell Stripes not to load it, chang-
ing its package is not the only way to do that—you can also
annotate the class with @DontAutoLoad .
Stripes defines key functionalities with interfaces so that you
can easily provide custom behavior by plugging in your own
extensions. We'll discover the other extensible parts of Stripes
throughout the rest of the topic.
 
 
Search WWH ::




Custom Search