Filter « URL « JSP-Servlet Q&A

1. Exclude filter from certain url's

I'm using a filter in web.xml to check if a user is logged in or not:


2. Can I exclude some concrete urls from inside ?

I want some concrete filter to be applied for all urls except for one concrete (i.e. for /* except for /specialpath). Is there a possibility to do that?

sample code:

3. Web.xml - url pattern mapped twice

A web.xml of ours contains following excerpt..



4. Filter mapping url-pattern that excludes subdirectories

Is there any way to make a filtermapping not include subdirectories? For example. I have .xhtml files in my context root, and I also have a subfolder named "test" with files with the ...

5. Servlet filter url mapping

How can a filter be mapped to the root of a URL? I'm using Tomcat 7.0.2 and deploying an application as ROOT.war. The welcome page is sign_in.xhtml. I ...

6. Problem with URL mapping in servlet filter

I already have two filters, which typically checks for a valid session. If session is valid it'll redirect to the ExpenseDetailsManagement.html else ExpenseManagementLogin.html. The web.xml config looks like


7. Can we have NOT condition in url-mapping for servlet-filter

Is is possible to have NOT condition as a value for url-mapping for servlet-filter? Ex: I want to filter all the requests that does not contain "." so lets consider I have a ...

8. How to pass parameters by URL in web.xml?

I need to have something like this: /{paramvalue}/url And get the value of param value, and point the url to the servlet. For example: /josua/profile /mary/messages "/josua/" and "/mary/" is the parameter that I need to get And ...

9. tomcat filter url-pattern problem

Hi i have a tomcat server version 5.5.12 and i am using a filter, the problem is that for some files the filter works and for other it doesnt, for example for ...

10. Recording url navigation history

Goal: User tries to access page without authentication. Site redirects to login page, when they enter details they are returned to the page they were trying to access. I have a filter ...

11. How to prevent a user from accessing the site when he/she Copy and paste the url address to get in to the site?

How to prevent a user from accessing the site when he/she Copy and paste the url address to get in to the site.They should only login to get to the site.If ...

14. Multiple url-pattern in filter-mapping OC4j Servlet 2.5

"Ah, sorry. I don't know where I saw that. I just tried something similar for servlet mappings in an IDE and it created multiple element blocks. Can you try that? For example:" Yes that works just fine, but that is Servlet 2.4 style and I am trying to avoid the problem of extra typing.