Message from discussion
Issue 635 in google-guice: GuiceFilter uses wrong instance of FilterPipeline if used with multiple servlet context and multiple injectors
Received: by 10.101.149.32 with SMTP id b32mr3602524ano.18.1307498331761;
Tue, 07 Jun 2011 18:58:51 -0700 (PDT)
X-BeenThere: google-guice-dev@googlegroups.com
Received: by 10.150.44.22 with SMTP id r22ls4595156ybr.2.gmail; Tue, 07 Jun
2011 18:58:50 -0700 (PDT)
Received: by 10.236.83.205 with SMTP id q53mr829837yhe.88.1307498330932;
Tue, 07 Jun 2011 18:58:50 -0700 (PDT)
Received: by 10.236.83.205 with SMTP id q53mr829836yhe.88.1307498330920;
Tue, 07 Jun 2011 18:58:50 -0700 (PDT)
Return-Path: <3WtfuTQwOAG4SaaSXQ-SgUOQSaaSXQOaPQ....@codesite.bounces.google.com>
Received: from mail-gw0-f76.google.com (mail-gw0-f76.google.com [74.125.83.76])
by gmr-mx.google.com with ESMTPS id c22si38581yhe.0.2011.06.07.18.58.50
(version=TLSv1/SSLv3 cipher=OTHER);
Tue, 07 Jun 2011 18:58:50 -0700 (PDT)
Received-SPF: pass (google.com: domain of 3WtfuTQwOAG4SaaSXQ-SgUOQSaaSXQOaPQ....@codesite.bounces.google.com designates 74.125.83.76 as permitted sender) client-ip=74.125.83.76;
Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of 3WtfuTQwOAG4SaaSXQ-SgUOQSaaSXQOaPQ....@codesite.bounces.google.com designates 74.125.83.76 as permitted sender) smtp.mail=3WtfuTQwOAG4SaaSXQ-SgUOQSaaSXQOaPQ....@codesite.bounces.google.com
Received: by gwaa11 with SMTP id a11so96gwa.1
for <google-guice-dev@googlegroups.com>; Tue, 07 Jun 2011 18:58:50 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.224.196.196 with SMTP id eh4mr1676494qab.3.1307498330775; Tue,
07 Jun 2011 18:58:50 -0700 (PDT)
Reply-To: codesite-nore...@google.com
X-Generated-By: Google Code
X-GoogleCode-Project: google-guice
X-GoogleCode-Issue-Id: 635
Message-ID: <0-1492727805935382846-3197605416504241051-google-guice=googlecode.com@googlecode.com>
Date: Wed, 08 Jun 2011 01:58:50 +0000
Subject: Issue 635 in google-guice: GuiceFilter uses wrong instance of
FilterPipeline if used with multiple servlet context and multiple injectors
From: google-gu...@googlecode.com
To: google-guice-dev@googlegroups.com
Content-Type: text/plain; charset=ISO-8859-1; format=flowed; delsp=yes
Status: New
Owner: ----
New issue 635 by carsten....@gmail.com: GuiceFilter uses wrong instance of
FilterPipeline if used with multiple servlet context and multiple injectors
http://code.google.com/p/google-guice/issues/detail?id=635
In short:
Servlet Container: Jetty 8.0.0 M3
Guice: 3.0 + Servlet Extension (3.0)
If i create multiple servlet context and configure each of them with a
dedicated injector based on a dedicated servlet module, GuiceFilter aquires
always the FilterPipeline according to the last added servlet
context/injector - no matter which servlet context my HTTP request leads to.
e.g.
Servlet Context A (context path: /a)
Configured with dedicated GuiceFilter & GuiceServletContextListener
providing Injector holding
Servlet Module incl. serve("/hello", HelloAServlet.class)
Servlet Context B (context path: /b)
Configured with dedicated GuiceFilter & GuiceServletContextListener
providing Injector holding
Servlet Module incl. serve("/hello", HelloBServlet.class)
If i add mentioned context in listed order, i will always receive
HelloBServlet.class, no matter if i invoke /hello/a - or /hello/b in my
browser.
I did not spend much time yet to find a clean solution, but what i can say
is that some debugging in GuiceFilter tells me that it somehow uses the
wrong (Managed)FilterPipeline on request / GuiceFilter.doFilter - but it is
associated to the correct servlet context.
So if (i know, not clean solution) i extend GuiceFilter.setPipeline to put
the here given FilterPipeline (which is still correct at this time) into
provided servlet context AND then use this pipeline again in
GuiceFilter.doFilter - all problems are solved.