Return-Path: X-Original-To: apmail-geronimo-scm-archive@www.apache.org Delivered-To: apmail-geronimo-scm-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id EE604964F for ; Thu, 16 Feb 2012 14:45:03 +0000 (UTC) Received: (qmail 66070 invoked by uid 500); 16 Feb 2012 14:45:03 -0000 Delivered-To: apmail-geronimo-scm-archive@geronimo.apache.org Received: (qmail 66023 invoked by uid 500); 16 Feb 2012 14:45:03 -0000 Mailing-List: contact scm-help@geronimo.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: dev@geronimo.apache.org List-Id: Delivered-To: mailing list scm@geronimo.apache.org Received: (qmail 66014 invoked by uid 99); 16 Feb 2012 14:45:03 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 16 Feb 2012 14:45:03 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 16 Feb 2012 14:44:59 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 89C5123888E7; Thu, 16 Feb 2012 14:44:38 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: scm@geronimo.apache.org From: xuhaihong@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120216144438.89C5123888E7@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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); + } } - }