Thanks,
Sherif
- Chinna
SCJP 5 | SCWCD 5
[How to ask questions] [Twitter]
Thanks,
Sherif
Sherif Shehab wrote:but there is not any request's object in the session listener ...
SCJP 5 | SCWCD 5
[How to ask questions] [Twitter]
Vijitha Kumara wrote:
Sherif Shehab wrote:but there is not any request's object in the session listener ...
Yes, HttpSessionListener is for get notified when a Session is created not for anything about a request. But you have access to the particular request object when creating a session right (that's when the listener get notified)?
Thanks,
Sherif
SCJP 5 | SCWCD 5
[How to ask questions] [Twitter]
Vijitha Kumara wrote:HttpSessionListener is passed HttpSessionEvent which you have access to only HttpSession through "getSession()" method. What exactly you want to do with the listener here ?
Thanks,
Sherif
- Chinna
Chinna Eranna wrote:You cannot access ip in your HttpSessionListener, as you dont have request object.
But this HttpSessionListener is invoked, when you create session.
And the session is created using the request object.
Using that request object.. you can get the ip address of client.
If you still need any clarifications.. Post the code where you create the sessions.
Thanks,
Sherif
- Chinna
swapnl patil wrote:Instead of doing this stuff use filters where you will get Request & Response Object & you can track the IP Address,Name of Incoming Request.
I hope this will help you.
Thanks,
Sherif
i need to get the IP as soon as the session was created, so this needs session listener.
Thanks,
Sherif
Sherif Shehab wrote:Now i;m little bit confused about when this method is called public void sessionCreated(HttpSessionEvent se) , is it called when the server creates the session for the first time or when i create a session object like this : in any place in my application ?
SCJP 5 | SCWCD 5
[How to ask questions] [Twitter]
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime. |