geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xuhaih...@apache.org
Subject svn commit: r1245001 - /geronimo/server/branches/3.0-beta/plugins/tomcat/geronimo-tomcat7/src/main/java/org/apache/geronimo/tomcat/interceptor/RequestListenerBeforeAfter.java
Date Thu, 16 Feb 2012 14:44:38 GMT
Author: xuhaihong
Date: Thu Feb 16 14:44:38 2012
New Revision: 1245001

URL: http://svn.apache.org/viewvc?rev=1245001&view=rev
Log:
Only invoke the request listener while entering the application and only invoking the listener
if the forwarding tag is set

Modified:
    geronimo/server/branches/3.0-beta/plugins/tomcat/geronimo-tomcat7/src/main/java/org/apache/geronimo/tomcat/interceptor/RequestListenerBeforeAfter.java

Modified: geronimo/server/branches/3.0-beta/plugins/tomcat/geronimo-tomcat7/src/main/java/org/apache/geronimo/tomcat/interceptor/RequestListenerBeforeAfter.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0-beta/plugins/tomcat/geronimo-tomcat7/src/main/java/org/apache/geronimo/tomcat/interceptor/RequestListenerBeforeAfter.java?rev=1245001&r1=1245000&r2=1245001&view=diff
==============================================================================
--- geronimo/server/branches/3.0-beta/plugins/tomcat/geronimo-tomcat7/src/main/java/org/apache/geronimo/tomcat/interceptor/RequestListenerBeforeAfter.java
(original)
+++ geronimo/server/branches/3.0-beta/plugins/tomcat/geronimo-tomcat7/src/main/java/org/apache/geronimo/tomcat/interceptor/RequestListenerBeforeAfter.java
Thu Feb 16 14:44:38 2012
@@ -14,16 +14,21 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
+
 package org.apache.geronimo.tomcat.interceptor;
 
+import javax.servlet.DispatcherType;
 import javax.servlet.ServletRequest;
 import javax.servlet.ServletResponse;
 
 import org.apache.geronimo.tomcat.GeronimoStandardContext;
 
-public class RequestListenerBeforeAfter implements BeforeAfter{
+public class RequestListenerBeforeAfter implements BeforeAfter {
+
     private final BeforeAfter next;
+
     private final int index;
+
     private final GeronimoStandardContext standardContext;
 
     public RequestListenerBeforeAfter(BeforeAfter next, int index, GeronimoStandardContext
standardContext) {
@@ -32,20 +37,24 @@ public class RequestListenerBeforeAfter 
         this.standardContext = standardContext;
     }
 
-    public void before(BeforeAfterContext beforeAfterContext, ServletRequest httpRequest,
ServletResponse httpResponse, int dispatch) {
+    public void before(BeforeAfterContext beforeAfterContext, ServletRequest httpRequest,
ServletResponse httpResponse,
+            int dispatch) {
         if (httpRequest != null && httpResponse != null) {
-            standardContext.fireRequestInitEventInBeforeAfter(httpRequest);
+            DispatcherType dispatcherType = httpRequest.getDispatcherType();
+            if (dispatcherType == DispatcherType.REQUEST
+                    || (dispatcherType == DispatcherType.FORWARD && standardContext.getFireRequestListenersOnForwards()))
{
+                standardContext.fireRequestInitEventInBeforeAfter(httpRequest);
+            }
         }
         if (next != null) {
             next.before(beforeAfterContext, httpRequest, httpResponse, dispatch);
         }
     }
-    
 
-    public void after(BeforeAfterContext beforeAfterContext, ServletRequest httpRequest,
ServletResponse httpResponse, int dispatch) {       
-            if (next != null) {
-                next.after(beforeAfterContext, httpRequest, httpResponse, dispatch);
-            }
+    public void after(BeforeAfterContext beforeAfterContext, ServletRequest httpRequest,
ServletResponse httpResponse,
+            int dispatch) {
+        if (next != null) {
+            next.after(beforeAfterContext, httpRequest, httpResponse, dispatch);
+        }
     }
-
 }



Mime
View raw message