| Author |
Filtering All Actions *Except* One
|
Corey McGlone
Ranch Hand
Joined: Dec 20, 2001
Posts: 3271
|
|
I've run into a situation in which I'd like to apply a filter to all *.do actions except one. Is there any way to do that short of adding every action as a URL mapping to the deployment descriptor. For my particular case, I require that the user select the site he/she would like to administer before using my application. To do that, they go through an action called "setupsiteselection.do". I've created a Filter that will check to see if a site identifier is stored in the session or not. If it isn't, the user is redirected so that he/she selects a site before accessing the page. If it's there, the user simply goes on. I want this filter to be applied to most of my JSP's and all of the actions except for the one I indicated previously. The JSP's aren't an issue - it's the actions that are giving me a headache. Anyone know of a good way to get around this - I don't want to add every individual action to the URL Mappings as there are dozens of actions in the application. Thanks, Corey
|
SCJP Tipline, etc.
|
 |
Jeanne Boyarsky
internet detective
Marshal
Joined: May 26, 2003
Posts: 26177
|
|
Corey, I would handle that by having the filter get called for all *.do actions. Then the filter can check the path and see if it was the one admin/setup action. While I generally try to avoid referencing the path from the action, I think it outweighs the risk of forgetting to add an action to the filter later.
|
[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
|
 |
Corey McGlone
Ranch Hand
Joined: Dec 20, 2001
Posts: 3271
|
|
Originally posted by Jeanne Boyarsky: I would handle that by having the filter get called for all *.do actions. Then the filter can check the path and see if it was the one admin/setup action.
Thanks, Jeanne. That's the solution I had come up with and implemented, but I didn't really like putting the path into the filter code. It works, but I was wondering if someone had a better approach. That doesn't seem to be the case. Thanks.
|
 |
James Carman
Ranch Hand
Joined: Feb 20, 2001
Posts: 580
|
|
|
You could use a filter init parameter.
|
James Carman, President<br />Carman Consulting, Inc.
|
 |
 |
|
|
subject: Filtering All Actions *Except* One
|
|
|