tapestry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hls...@apache.org
Subject svn commit: r539229 - /tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/TapestryFilter.java
Date Fri, 18 May 2007 03:02:50 GMT
Author: hlship
Date: Thu May 17 20:02:49 2007
New Revision: 539229

URL: http://svn.apache.org/viewvc?view=rev&rev=539229
Log:
TAPESTRY-1464: Cannot Subclass TapestryFilter to add custom init() and destroy() logic

Modified:
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/TapestryFilter.java

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/TapestryFilter.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/TapestryFilter.java?view=diff&rev=539229&r1=539228&r2=539229
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/TapestryFilter.java
(original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/TapestryFilter.java
Thu May 17 20:02:49 2007
@@ -90,12 +90,33 @@
                 "HttpServletRequestHandler",
                 HttpServletRequestHandler.class);
 
+        init(_registry);
+
         long toFinish = System.currentTimeMillis();
 
         _log.info(format("Startup time: %,d ms to build IoC Registry, %,d ms overall.", toRegistry
                 - start, toFinish - start));
     }
 
+    protected final FilterConfig getFilterConfig()
+    {
+        return _config;
+    }
+
+    /**
+     * Invoked from {@link #init(FilterConfig)} after the Registry has been created, to allow
any
+     * additional initialization to occur. This implementation does nothing, and my be overriden
in
+     * subclasses.
+     * 
+     * @param registry
+     *            from which services may be extracted
+     * @throws ServletException
+     */
+    protected void init(Registry registry) throws ServletException
+    {
+
+    }
+
     /**
      * Overridden in subclasses to provide additional module definitions beyond those normally
      * located. This implementation returns an empty array.
@@ -124,13 +145,24 @@
 
     /** Shuts down and discards the registry. */
     public final void destroy()
-
     {
         _registry.shutdown();
 
         _registry = null;
         _config = null;
         _handler = null;
+    }
+
+    /**
+     * Invoked from {@link #destroy()} to allow subclasses to add additional shutdown logic
to the
+     * filter. The Registry will be shutdown after this call. This implementation does nothing,
and
+     * may be overridden in subclasses.
+     * 
+     * @param registry
+     */
+    protected void destroy(Registry registry)
+    {
+
     }
 
 }



Mime
View raw message