jQuery in Action, 2nd edition*
The moose likes Servlets and the fly likes Problem to filter requests to App name Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Problem to filter requests to App name" Watch "Problem to filter requests to App name" New topic
Author

Problem to filter requests to App name

Justin Howard
Ranch Hand

Joined: Feb 19, 2009
Posts: 162
Hi All,

I want to configure the filter for any resource that is requested in the app.


but this doesn't seem to work. It doesn't even go to the filter.

Thanks

Sebastian Janisch
Ranch Hand

Joined: Feb 23, 2009
Posts: 1183
I think this thread belongs to the Servlet forum.

all urls accessed through http://localhost:8080/webProjectName/FORMS/...

should invoke the filter.
Note that the url-pattern is case sensitive.


JDBCSupport - An easy to use, light-weight JDBC framework -
Justin Howard
Ranch Hand

Joined: Feb 19, 2009
Posts: 162
FORMS is the web project name.
So the urls will be http;//localhost:8080/FORMS/somepage.jsp

But it is not going to the filter.
Sebastian Janisch
Ranch Hand

Joined: Feb 23, 2009
Posts: 1183
Ok that is where the problem is.

The url-pattern takes the context-root, which is the root of your web-application.

Omit the FORMS in your url-pattern and you are all set.
Justin Howard
Ranch Hand

Joined: Feb 19, 2009
Posts: 162
If I give the context-root it wont work?

What should I do if I have to prevent the access to any resource inside the app.

Thank you for the reply.
Sebastian Janisch
Ranch Hand

Joined: Feb 23, 2009
Posts: 1183
if your web-application has the name FORMS, so the directory structure is /tomcat/webapps/FORMS

then the filter mapping of

<url-pattern>/secured/*</url-pattern>

will shoot all requests targeting http://localhost:8080/FORMS/secured/something through the filter.

A filter mapping of '/*' applies to your whole web app.
Justin Howard
Ranch Hand

Joined: Feb 19, 2009
Posts: 162
Thank you !
 
Consider Paul's rocket mass heater.
 
subject: Problem to filter requests to App name