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

how tto initialize HttpServletRequest

 
nimo frey
Ranch Hand
Posts: 580
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How can I obtain the reference of an HttpServletRequest within the sessionCreated-Method of HttpSessionListener?

something like:



This does not work:


Any Ideas?
[ September 08, 2008: Message edited by: nimo frey ]
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can't directly initialize an HttpServletRequest. Why are you trying to? What is it you are trying to do?
 
nimo frey
Ranch Hand
Posts: 580
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to get the methods available of HttpServletRequest.

I want to do something like:



Should I implement a method in my listener:



then I can call the global String ip in my sessionCreated-Method:



But this does not work..string is allways null.

any ideas?
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A session listener is designed to listen to session events. If you want to handle requests a Servlet is the tool you would normally use. If you want functionality accross all requests, a filter is a better choice.
 
nimo frey
Ranch Hand
Posts: 580
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As I use JSF and want avoid implementing Servlets directyl, I will try to use filters..

thanks.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic