This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem to filter requests to App name

 
Justin Howard
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Justin Howard
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 162
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 162
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you !
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic