Solved

Filter Setup

Posted on 2002-05-30
10
331 Views
Last Modified: 2010-04-01
I am having trouble setup a filter to function on only my jsp files. Below is what i have in my web.xml file. But it does not function.  How do i specify this correctly?

<filter>
<filter-name>SemestreSelectedFilter</filter-name>
<filter-class>ies.SemestreSelectedFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>SemestreSelectedFilter</filter-name>
<url-pattern>/*.jsp</url-pattern>
</filter-mapping>

Thanks
0
Comment
Question by:menreeq
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
  • 2
10 Comments
 
LVL 19

Expert Comment

by:cheekycj
ID: 7044658
what is not working?

How do you know your filter is not being invoked?

Make sure you are using a servlet engine (Tomcat 4.0 and greater or a servlet engine that supports Servlet 2.3 spec) that supports Filters.

CJ
0
 

Author Comment

by:menreeq
ID: 7046600
When i use "/*.jsp" it does not invoke the filter for any files.  I know it works because when i change it to "/*" it functions on all the files, including the images in the sub-directory.  

Perhaps it´s due to me calling url-pattern and not specifying a valid pattern?  Or is "/*.jsp" a valid url-pattern?
0
 
LVL 4

Accepted Solution

by:
pellep earned 100 total points
ID: 7053658
try
*/*.jsp
or
*.jsp
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 19

Expert Comment

by:cheekycj
ID: 7053836
have you tried just this:

<filter-mapping url-pattern="*.jsp" filter-name="ies.SemestreSelectedFilter" />

or

<filter-mapping url-pattern="/*.jsp" filter-name="ies.SemestreSelectedFilter" />
0
 

Author Comment

by:menreeq
ID: 7056112
I have tried *.jsp.

I will try now /*.jsp and */*.jsp

0
 
LVL 4

Expert Comment

by:pellep
ID: 7056181
<url-pattern>*.jsp</url-pattern>
has always worked for me. it could be that there is already a 'default' filter in place defined earlier in the web.xml file.
0
 
LVL 19

Expert Comment

by:cheekycj
ID: 7075683
any updates?
0
 

Author Comment

by:menreeq
ID: 7076313
Ya, my computer got a virus, trying to resrore everthing.  Will try your suggestion just as soon as i have everything back online.
0
 
LVL 19

Expert Comment

by:cheekycj
ID: 7076320
ok.  sorry to hear about the virus.. take your time and let us know.

CJ
0
 

Author Comment

by:menreeq
ID: 7080061
Once again sorry for the delay. I tried *.jsp with out the / and it worked.  Thanks for the help!
0

Featured Post

Want Experts Exchange at your fingertips?

With Experts Exchange’s latest app release, you can now experience our most recent features, updates, and the same community interface while on-the-go. Download our latest app release at the Android or Apple stores today!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

With the rising number of cyber attacks in recent years, keeping your personal data safe has become more important than ever. The tips outlined in this article will help you keep your identitfy safe.
Let's recap what we learned from yesterday's Skyport Systems webinar.
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Suggested Courses

624 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question