tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bill Barker" <wbar...@wilshire.com>
Subject Re: Tomcat 6 and Servlet filter problem
Date Wed, 21 May 2008 01:48:10 GMT

"ManojS" <manoj_mrs@yahoo.co.in> wrote in message 
news:17337357.post@talk.nabble.com...
>
> Hello,
>
> I was trying to integrate a web application in Tomcat 6. That application
> uses a servlet filter to append few parameters to all the requests of its
> resources. The web.xml file with filter configuration is as follows.
>
>
>
>> <?xml version="1.0" encoding="UTF-8" ?>
>> <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application
>> 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
>> <web-app>
>>  <filter>
>>   <filter-name>ParamFilter</filter-name>
>>   <filter-class>com.somecompany.ParamFilter</filter-class>
>>  </filter>
>>
>>  <filter-mapping>
>>   <filter-name>ParamFilter</filter-name>
>>   <url-pattern>/Jsp/*</url-pattern>
>>  </filter-mapping>
>> ........
>> </web-app>
>>
>
> My problem is, while I am requesting any resources inside the "Jsp" 
> folder,
> the servlet filter's doFilter method is not executing. But in the log it 
> is
> showing that the servlet filter's init method is executed correctly.
>

How do you know that the doFilter method isn't executing?  The first thing I 
would try is to create a dummy JSP page in the Jsp folder that looks 
something like:
<html>
<head></head>
<body>
<pre>
<% (new Exception()).printStackTrace(out); %>
</pre>
</body>
</html>

If your Filter shows up in the stack trace, then it is being called, and the 
problem is in the Filter.


> Can anyone help me to figureout the problem ? Or suggest any solution ?
> Thanks a lot in advance.
>

In general, adding parameters in a Filter is a lot of work with Tomcat, 
since Tomcat will parse the parameters only once at a place that is in 
general hard to predict.  Usually you have to override all of the parameter 
related methods in your HttpServletRequestWrapper to make certain that they 
show up in the target servlet.
> Manoj.
>
> -- 
> View this message in context: 
> http://www.nabble.com/Tomcat-6-and-Servlet-filter-problem-tp17337357p17337357.html
> Sent from the Tomcat - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> 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


Mime
View raw message