Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

What do you think of my filter ?

 
Hussein Baghdadi
clojure forum advocate
Bartender
Posts: 3479
Clojure Mac Objective C
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi.
I'm creating a small web forum, this forum uses cookies to store username and password.
This app contains a servlet filter, this filter is responsible to try to collect the cookies and create a session scope object contains the informations (this filter is applied to all pages in the app).
Some code:

getUserFromCookies(request, session); is a method iterates over the cookies in user's cache and try to create a session scope object.
What do you think of my design ? is it good (implementation, performance, a hole ....)
Thanks guys.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34095
337
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
John,
The logic/design are sound. My only question is why you are passing both request and session to the getUserFromCookies method. As you can get either from the other, this is a redundant parameter.

I would also move the chain doFilter() call outside the if statement since it is done either way. The intent is a bit clearer that way.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic