GenericServletService and GenericFilterService Classes

4 05 2008

For anyone doing development in J2EE and ATG I wrote an extremely useful servlet and filter base class developers might be interested in. These classes were used as base classes for many of the framework components that were used as part of ATG Portals but they can be used in any standard J2EE application. 

I think the javadoc explains them nicely. Here’s the javadoc for the GenericFilterService which implements the javax.servlet.Filter interface. Similarly there’s a class called the GenericServletService which implements the javax.servlet.Servlet interface. See the ATG documentation for more information on these classes.

public class GenericFilterService
extends java.lang.Object
implements javax.servlet.Filter

Filter implementation with support for self-configuration, naming resolution, performance profiling and logging.

Derived class should override the following methods:

  • startService
  • doFilterRequest
  • stopService


The filter may be configured from filter init parameters. specified in a web application deployment descriptor. Named init parameters are treated as properties of the filter. Parameters prefixed with cxt: are looked up using the filters name context.

The following example serves to demonstrate configuration of a generic filter service:




Derived filters may use the lookup method to lookup objects in the filters name context. The objects name context is accessable via the context property.

The filter may log information using the logging facilities provided. Support for info, warning, error and debug levels are provided by the service.

If a performance monitor is enabled the filter collects performance metrics about the handleDoFilter method.




2 responses

5 05 2008
links for 2008-05-05 | iKeif

[…] screen DIY design diy electronics gadgets guide hack howto multitouch osx touchscreen GenericServletService and GenericFilterService Classes « Meta Theory 13 hours agoUseful ATG Base Classes – god knows I may need these.atg classes code filters Robert […]

15 08 2009

where’s the dowmload?

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: