Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 339
  • Last Modified:

Filter Setup

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
menreeq
Asked:
menreeq
  • 4
  • 4
  • 2
1 Solution
 
cheekycjCommented:
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
 
menreeqAuthor Commented:
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
 
pellepCommented:
try
*/*.jsp
or
*.jsp
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
cheekycjCommented:
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
 
menreeqAuthor Commented:
I have tried *.jsp.

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

0
 
pellepCommented:
<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
 
cheekycjCommented:
any updates?
0
 
menreeqAuthor Commented:
Ya, my computer got a virus, trying to resrore everthing.  Will try your suggestion just as soon as i have everything back online.
0
 
cheekycjCommented:
ok.  sorry to hear about the virus.. take your time and let us know.

CJ
0
 
menreeqAuthor Commented:
Once again sorry for the delay. I tried *.jsp with out the / and it worked.  Thanks for the help!
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 4
  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now