• Post Reply Bookmark Topic Watch Topic
  • New Topic

Using Filters with Declarative Security login.jsp

 
Chris Barrett
Bartender
Posts: 317
24
Eclipse IDE Firefox Browser
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I've been building out a course lab project over the last few weeks, and at the time (with what we knew), it made sense to use a session level ResourceBundle to facilitate translations.
In order to validate if there is a session level ResourceBundle, I have a filter running (checking if the bundle exists, creating one if not, etc...).

The problem I now have is the final step of the project (the part most recently taught), is to add Declarative Security.

Of course, when that happens the login.jsp is called and the Filter doesn't run. It's not a problem for most scenarios, except for someone who bookmarks a link inside the secure part of the site. Then, the ResourceBundle doesn't exist and the login.jsp content that should be translated is "".

Is there a way to indicate via the web.xml that a specific Filter should be allowed before the login.jsp is displayed?

Cheers!
Chris

PS - I imagine JSTL:FMT is probably the best solution, but we don't cover that until after the lab is due. I have a (messy) short-term solution of creating a temporary ResourceBundle in the login.jsp via a scriplet if the session scope ResourceBundle is null, but I was wondering if I missed something with the web.xml.
 
Chris Barrett
Bartender
Posts: 317
24
Eclipse IDE Firefox Browser
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I ran with a custom translation tag that wraps the content of the login.jsp and login-error.jsp, checks of the ResourceBundle is present in the session and if not creates a temporary one until the real LanguageFilter can be run.
Not a perfect solution, but worked well enough since the issue was limited to only these two pages.

Cheers!
Chris
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!