From dev-return-57231-apmail-geronimo-dev-archive=geronimo.apache.org@geronimo.apache.org Thu Nov 29 17:47:41 2007 Return-Path: Delivered-To: apmail-geronimo-dev-archive@www.apache.org Received: (qmail 38782 invoked from network); 29 Nov 2007 17:47:41 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 29 Nov 2007 17:47:41 -0000 Received: (qmail 1243 invoked by uid 500); 29 Nov 2007 17:47:27 -0000 Delivered-To: apmail-geronimo-dev-archive@geronimo.apache.org Received: (qmail 1190 invoked by uid 500); 29 Nov 2007 17:47:27 -0000 Mailing-List: contact dev-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 dev@geronimo.apache.org Received: (qmail 1179 invoked by uid 99); 29 Nov 2007 17:47:27 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 29 Nov 2007 09:47:27 -0800 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of ammulder@gmail.com designates 64.233.184.227 as permitted sender) Received: from [64.233.184.227] (HELO wr-out-0506.google.com) (64.233.184.227) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 29 Nov 2007 17:47:07 +0000 Received: by wr-out-0506.google.com with SMTP id 68so1535098wra for ; Thu, 29 Nov 2007 09:47:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:sender:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references:x-google-sender-auth; bh=TZ0AOIZH5cY/XNzHRfnok5q6vBWktfAHOB8+Vo31zxU=; b=WE5iMUBY62V/ZdQqBUQ94GPr3Sanr0kigdGimieqr63HrxE4XdlE+8zaKDYHdcScHMO5WyyXSbhIlN6CckLJjPaD21qw5v21ZmXBAaBGkgdKOmitjGRds+2bVGu0PZ4ie52txB0AYKSv0AA205itjZVETzG5p+f1JxItCuxwh0M= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=received:message-id:date:from:sender:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references:x-google-sender-auth; b=THChXVyJ+ToTIq30tgFz7do7M+ncBExE7d6gFVQIYqS+tWuFTXA1rCQ9bhTFP0NlBusN5LmZ6YXRhDw0BV1dKcRNzwOfTE90cQlb4bYIqAkjpGVzDnUOYKCV6EC2pOwVtW/HTjzoJ90TSQV5/TiWTKy1jDQ8cTuKjmWinhEzE0s= Received: by 10.78.203.15 with SMTP id a15mr944104hug.1196358425150; Thu, 29 Nov 2007 09:47:05 -0800 (PST) Received: by 10.78.162.13 with HTTP; Thu, 29 Nov 2007 09:47:05 -0800 (PST) Message-ID: <74e15baa0711290947p4ec863bege2d50cefe8c934cf@mail.gmail.com> Date: Thu, 29 Nov 2007 12:47:05 -0500 From: "Aaron Mulder" Sender: ammulder@gmail.com To: dev@geronimo.apache.org Subject: Re: Inserting a filter into the web container In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <74e15baa0711290905x6023859dn6c2f6a87b154df5d@mail.gmail.com> X-Google-Sender-Auth: 3d9f6e8a5f4da11b X-Virus-Checked: Checked by ClamAV on apache.org OK, after an IRC chat, it seems like an alternative would be: For Tomcat, update the "base web app" configuration to add a servlet filter to the default config. For Jetty, a similar "default filter" and "default filter mapping" feature was planned but not yet finished. That could be finished and then a similar thing could be done for Jetty. That way, the code would be the same, it would just be the web container configuration to invoke it that would be different. On the other hand, it's not yet clear how to get the JAR with the filter into the class path for the web app. For example, changing the base web app in Tomcat might take affect soon (say, next restart), but any previously-deployed apps wouldn't have the JAR on their class path, which could cause the app to fail. In any case, apps to be deployed in the future could use a modified deployer default environment to add the JAR. So... some more investigation necessary, but a promising start. Thanks, Aaron On Nov 29, 2007 12:20 PM, David Jencks wrote: > I guess you could write a ModuleBuilderExtension that modified > web.xml to add the filter and appropriate filter mapping. I think > you'd need to do the work in the initContext method. I'm not sure if > I'd call this method "good" or not but its all I can think of right now. > > In the createModule method you can add the jar containing your filter > to the dependencies so the web app can actually find the filter... > > hope this helps > david jencks > > > On Nov 29, 2007, at 9:05 AM, Aaron Mulder wrote: > > > Is there some good way to insert a filter/interceptor into the web > > container request processing chain that would work for both Tomcat and > > Jetty? For example, let's say you wanted to apply some particular > > request validation/auditing functionality to every application, > > without changing the application configuration (e.g. without updating > > web.xml). It would be easy to write a little request filter or > > interceptor to do it -- I'm just not sure what the best way is to hook > > that in so it gets executed, and whether we have common > > filters/interceptors for Tomcat and Jetty or whether you'd have to do > > something different for each. > > > > Thanks, > > Aaron > > >