Return-Path: Delivered-To: apmail-tomcat-users-archive@www.apache.org Received: (qmail 86456 invoked from network); 6 Sep 2007 11:52:47 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 6 Sep 2007 11:52:47 -0000 Received: (qmail 42688 invoked by uid 500); 6 Sep 2007 11:52:30 -0000 Delivered-To: apmail-tomcat-users-archive@tomcat.apache.org Received: (qmail 42309 invoked by uid 500); 6 Sep 2007 11:52:29 -0000 Mailing-List: contact users-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Users List" Delivered-To: mailing list users@tomcat.apache.org Received: (qmail 42298 invoked by uid 99); 6 Sep 2007 11:52:29 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 06 Sep 2007 04:52:29 -0700 X-ASF-Spam-Status: No, hits=1.2 required=10.0 tests=SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: 128.253.83.142 is neither permitted nor denied by domain of dns4@cornell.edu) Received: from [128.253.83.142] (HELO authusersmtp.mail.cornell.edu) (128.253.83.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 06 Sep 2007 11:53:45 +0000 Received: from [128.253.38.244] (defiant.ento.cornell.edu [128.253.38.244]) (authenticated bits=0) by authusersmtp.mail.cornell.edu (8.13.1/8.12.10) with ESMTP id l86Bq0SM007424 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT) for ; Thu, 6 Sep 2007 07:52:04 -0400 (EDT) Message-ID: <46DFE9E0.1050109@cornell.edu> Date: Thu, 06 Sep 2007 07:52:00 -0400 From: David Smith User-Agent: Mozilla Thunderbird 1.0.6 (Macintosh/20050716) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Tomcat Users List Subject: Re: How to get Request from RequestFacade References: <5b889e570709060343q23accd31y1137819c03439453@mail.gmail.com> <46DFE493.80608@cornell.edu> <5b889e570709060442q3a6349e1g7d806a015fac118f@mail.gmail.com> In-Reply-To: <5b889e570709060442q3a6349e1g7d806a015fac118f@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org Ok... do you need them to modify the request and/or response? Or are you trying to pull some information from the original tomcat internals? I first assumed you were attempting to modify the request or response, so a wrapper is ideal. All you have to do is create a class that extends HttpServletRequestWrapper or HttpServletResponseWrapper and override the methods you want. Then in the filter, just instantiate your request or response class with the original request or response in the constructor. When you chain to the next filter, just pass on the new request and response objects. --David Tremal Naik wrote: >That's the point, I don't know much about request/response wrapping. > >I don't need the Facade itself, what I need are the "real" Catalina >Request/Response objects hidden behind it. I don't know how to get >them from inside a Filter. > >Thanks, > >TN > >2007/9/6, David Smith : > > >>May I ask what exactly you want to do with the facade? Seems like you >>could do what you want with a request or response wrapper instead. >> >>--David >> >>Tremal Naik wrote: >> >> >> >>>Hello, >>>I'v been using a valve to perform license checking in my web >>>application. The method invoke(Request request, Response response) had >>>access to the Request and Response objects, allowing me to perform >>>some advanced operations. For instance, I made use of instructions >>>like: >>> >>>Session catalinaSession = request.getSessionInternal(false); >>>catalinaSession.access(); >>> >>>or >>> >>>Session[] managedSessions = request.getContext().getManager().findSessions(); >>> >>>Now, I'm moving the license validation code to a Filter. How do I >>>access org.apache.catalina.connector.Request/Response in the method >>>doFilter()? I see that I can only cast to a RequestFacade object: >>> >>>public void doFilter(ServletRequest sRequest, ServletResponse >>>sResponse, FilterChain chain) >>> throws IOException, ServletException >>> { >>> RequestFacade cRequest = (RequestFacade) sRequest; >>> ...... >>> >>> >>>but now, I cannot use the Facade to access the Request. How can I >>>solve this problem? Is it desirable accessing Catalina specific object >>> >>> >>>from a Filter? Should I rewrite my code/ redesign my license >> >> >>>validation framework? It is a very complex one, hance it may require >>>some effort. May you redirect me to some useful articles/resources? >>> >>> >>>Many thanks >>> >>> >>> >>> >>> >>--------------------------------------------------------------------- >>To start a new topic, e-mail: users@tomcat.apache.org >>To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org >>For additional commands, e-mail: users-help@tomcat.apache.org >> >> >> >> > > > > --------------------------------------------------------------------- To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org For additional commands, e-mail: users-help@tomcat.apache.org