Return-Path: Delivered-To: apmail-jakarta-tomcat-user-archive@apache.org Received: (qmail 20287 invoked from network); 17 Jun 2003 14:05:43 -0000 Received: from exchange.sun.com (192.18.33.10) by daedalus.apache.org with SMTP; 17 Jun 2003 14:05:43 -0000 Received: (qmail 11538 invoked by uid 97); 17 Jun 2003 14:08:03 -0000 Delivered-To: qmlist-jakarta-archive-tomcat-user@nagoya.betaversion.org Received: (qmail 11531 invoked from network); 17 Jun 2003 14:08:03 -0000 Received: from daedalus.apache.org (HELO apache.org) (208.185.179.12) by nagoya.betaversion.org with SMTP; 17 Jun 2003 14:08:03 -0000 Received: (qmail 18873 invoked by uid 500); 17 Jun 2003 14:05:28 -0000 Mailing-List: contact tomcat-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Tomcat Users List" Reply-To: "Tomcat Users List" Delivered-To: mailing list tomcat-user@jakarta.apache.org Received: (qmail 18858 invoked from network); 17 Jun 2003 14:05:28 -0000 Received: from h139-142-220-22.gtcust.grouptelecom.net (HELO brad.gbgraphics.com) (139.142.220.22) by daedalus.apache.org with SMTP; 17 Jun 2003 14:05:28 -0000 Received: from BALTHAZAR ([10.0.0.111]) by mail.gbgraphics.com (8.10.2/8.10.2) with ESMTP id h5HE5SW29897 for ; Tue, 17 Jun 2003 09:05:28 -0500 From: "Mike Curwen" To: Subject: Filters and 4.1.24 Date: Tue, 17 Jun 2003 09:05:39 -0500 Message-ID: <003701c334d9$891750a0$6f00000a@BALTHAZAR> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.3416 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 Importance: Normal X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N I've tried searching nagoya and the tomcat-user archive, though I'm notoriously bad at choosing keywords. So I apologize if this has come up hundreds of times before. I was working through an example of Filtering from WROX's Professional JSP 2nd Edition. Chapter 15 shows us how to create a Filter that uses wrapped response objects to include a footer at the bottom of every page. I just could *not* get the pre-compiled code to work, so I inserted my own debugging statements using log4j and let it run.. it seemed my single request invoked the filter between 1 and 3 times, apparently without pattern. what was happening was it would start to output the footer, but stop after the first word. I changed this word, and did other logging changes as a sanity check. My logging changes were visible, but that old word (now nowhere in code) was still getting output. Restarted the container, restarted the OS (WinXP).. couldn't get it to work! Then I read the following from the book: "At this point, some readers may question the necessity to test all 3 types of resources (static HTML, JSP and Servlet). However, if you're creating filters that must work across many types of resources, you *must* test against each type of resource. The is necessary because of type of resource is passed through a different resource processor, each of which potentially has different assumptions and behaviours..." Now what I had been doing up to that point is: http://localhost:8080/wrox/ So that was a static resource I was requesting.. index.html And yah, maybe that filter might get poked multiple times, once for the / request and once for the actual (internally determined) request for index.html and perhaps a final time when the static loader was invoked. So I tried to request: http://localhost:8080/wrox/jsp This produced a nice directory listing, at the bottom of which had my inserted footer, as expected. This is the directory listing resource processor. http://localhost:8080/wrox/jsp/findProd.jsp Produced a blank screen. Logging indicated that the filter received 'null' as the response input. So the Filter doesn't work through the JSP processor. At that point I gave up on the wrox app, and moved the filter over to the application I actually needed it for, and tried to invoke a few servlet resources. http://localhost:8080/myapp/myservlet This worked as expected. So the Filter worked with servlets. My results: static resources -> X (very odd behaviour, output from seemingly nowhere) JSP -> X (couldn't find the JSP to invoke) Servlet -> Y (worked as expected) Directory Listing -> Y (worked as expected) Has anyone else had issues with Filters and these various combinations ? ------------------------------------------- Mike Curwen Intermediate Programmer www.gb-im.com ------------------------------------------- ____ ____ ___ __ __ / ___| | __ ) |_ _| | \/ | | | _ | _ \ _____ | | | |\/| | | |_| | | |_) | |_____| | | | | | | \____| |____/ |___| |_| |_| --------------------------------------------------------------------- To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: tomcat-user-help@jakarta.apache.org