Return-Path: Delivered-To: apmail-jakarta-tomcat-user-archive@www.apache.org Received: (qmail 23696 invoked from network); 28 Apr 2005 18:07:45 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 28 Apr 2005 18:07:45 -0000 Received: (qmail 31806 invoked by uid 500); 28 Apr 2005 18:06:11 -0000 Delivered-To: apmail-jakarta-tomcat-user-archive@jakarta.apache.org Received: (qmail 31754 invoked by uid 500); 28 Apr 2005 18:06:11 -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 31672 invoked by uid 99); 28 Apr 2005 18:06:10 -0000 X-ASF-Spam-Status: No, hits=1.0 required=10.0 tests=FROM_ENDS_IN_NUMS,HTML_20_30,HTML_MESSAGE,RCVD_BY_IP X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: domain of roberto72@gmail.com designates 64.233.184.200 as permitted sender) Received: from wproxy.gmail.com (HELO wproxy.gmail.com) (64.233.184.200) by apache.org (qpsmtpd/0.28) with ESMTP; Thu, 28 Apr 2005 11:06:10 -0700 Received: by wproxy.gmail.com with SMTP id 71so682627wri for ; Thu, 28 Apr 2005 11:04:55 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:in-reply-to:mime-version:content-type:references; b=TZ+GHM8xMlqjlU7IDKMkGTnTF0zZY8n4TVMEDkgP/EvTLd8M4YcK1n02TU16hiSrPvVj0J2K/MPwbEwcfHrH3H7XPeafU3pLqxW9VIHdzbQFCyh0xRWj0T5nqhcEztejcEA0wT/YP0sQzYWnz1H/2tBOc8FKTrCtgp9bInVhmPE= Received: by 10.54.120.19 with SMTP id s19mr872156wrc; Thu, 28 Apr 2005 11:04:55 -0700 (PDT) Received: by 10.54.35.12 with HTTP; Thu, 28 Apr 2005 11:04:55 -0700 (PDT) Message-ID: Date: Thu, 28 Apr 2005 15:04:55 -0300 From: Roberto Reply-To: Roberto To: Tomcat Users List Subject: Re: Images & CSS not loaded after the request passes through a Servlet Filter In-Reply-To: <28791.12.27.179.239.1114709821.squirrel@webmail.chiron.lunarpages.com> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_2181_2199245.1114711495791" References: <28791.12.27.179.239.1114709821.squirrel@webmail.chiron.lunarpages.com> X-Virus-Checked: Checked X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N ------=_Part_2181_2199245.1114711495791 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Frank, You got it. The filter configuration, in the web.xml file, was intercepting ALL requests (/*). I really thought that the filter would intercept only requests for Servlets, not all HTTP requests... Thanks ! This problem was really pissing me off... :) Regards Roberto On 4/28/05, Frank W. Zammetti wrote: >=20 > Question: are the requests for images and CSS files also going through th= e > filter? I'm wondering if those requests are getting forarded to the logon > page too, which obviously wouldn't work. >=20 > -- > Frank W. Zammetti > Founder and Chief Software Architect > Omnytex Technologies > http://www.omnytex.com >=20 > On Thu, April 28, 2005 1:25 pm, Roberto said: > > Hi, > > > > I have a small java application, in which a servlet processes the=20 > request > > and then > > calls a JSP to present the data. Everything is OK with that=20 > configuration. > > Then, I decided > > to create a servlet filter, to redirect every request to that=20 > application, > > to a login page first. > > > > The code of that filter is the following: > > > > ****************************** > > public final class ApplicationFilter implements Filter { > > private FilterConfig _fc =3D null; > > > > public void init(FilterConfig filterConfig) > > throws ServletException { > > this._fc =3D filterConfig; > > } > > > > public void doFilter(ServletRequest request, > > ServletResponse response, > > FilterChain chain) > > throws IOException, > > ServletException { > > > > try { > > RequestDispatcher rd =3D > > _fc.getServletContext().getRequestDispatcher("/login"); > > rd.forward(request, response); > > } catch (Exception e) { > > System.out.println("Exception: " + e.getMessage()); > > e.printStackTrace(); > > } > > } > > > > -- (the rest was intentionally omitted) -- > > ******************************************* > > > > > > The redirection works great, BUT all images and CSS referenced in the= =20 > JSP > > file are not > > loaded after the request passes through the filter. The application run= s > > perfectly, and takes > > the user to the login screen, and after that, to the application. The > > application does some > > database queries and returns the data correctly. BUT, everything withou= t > > images or the > > styles defined in the CSS file. > > > > Just to make a test, I put the CSS file contents directly inside the JS= P > > file, and it > > worked great. In this case, images were not loaded also... > > > > The process flows like this: > > > > Request --> Filter --> login (a servlet) --> login.jsp --> queryDB (a > > servlet) --> queryDB.jsp > > > > When I disable the filter, in the web.xml file, everything works as=20 > would > > be > > expected. > > > > The configuration in web.xml is OK: all servlets are set, as is the=20 > filter > > itself. > > > > I'm using Tomcat 5.0.28 on a Gentoo Linux system, with POSIX threads an= d > > kernel > > 2.6.9. The hardware is a P IV HT 3.2 Ghz. > > > > I also checked the archives of this list, but was unable to find any > > reference to a problem > > like this one. Does anyone know what is happening ? > > > > Regards, > > Roberto > > >=20 > --------------------------------------------------------------------- > To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org > For additional commands, e-mail: tomcat-user-help@jakarta.apache.org >=20 > ------=_Part_2181_2199245.1114711495791--