Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Siteminder Session  RSS feed

 
ShivPrakash Srivastava
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I have my application configured with the siteminder and after session timeout,it goes back to the Siteminder login page.But after re login ,I get the NullPointerException.The reason is I have kept my data object in the session and somehow,it is null.I think when a new session is created the data object that I have kept is not retrived.Iam using getSession() method of the HttpSession.Does anyone have the idea abt this.

Waiting for the response.

Thanks and Reagdrs
Shiv
 
Rahul Bhattacharjee
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
After the successful login , developers prefer to keep the necessary information in the session and any other stuff that might be required further.In your case when you are re-login the same data should again be kept in the session to keep the application going further.What exactly do you do during login process ?
 
ShivPrakash Srivastava
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Rahul,

I dont have control over the login.Its a siteminder protected page.I just check for the session to be new or not using isNew() method.Iam not sure if I need to do anything in the code.Also when I print the session object details,I see my data object...but after re-Login,I dont find them in the session coz a new session is being created.Iam little confused on this.
How can I persist with my data object even if new session is created?

wiating eargerly for the reply

Thanks and Regards
Shiv
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you don't have control over the login, then you will need to check every item that you read from session to insure that it is not null before trying to use it.
 
Rahul Bhattacharjee
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by ShivPrakash Srivastava:

I dont have control over the login.Its a siteminder protected page.I just check for the session to be new or not using isNew() method.Iam not sure if I need to do anything in the code.Also when I print the session object details,I see my data object...but after re-Login,I dont find them in the session coz a new session is being created.Iam little confused on this.
How can I persist with my data object even if new session is created?


I am sure that the data that you are talking about is user specific , that might be the reason that its stored in the session on in the servlet context.Once the session is destroyed , all the attributes stored in the session are also lost and cannot be recovered.If you are re-login and still the data doesn't appear then surely those data's are stored at some point after the login.You have to look into the applications flow.

Hope this helps,


 
ShivPrakash Srivastava
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Yes you are exactly right...these data are user specific data.which I keep it in session after login.After relogin these data are lost.Is there any way that I keep these data in the session so that after re login I can get them again.

Thanks and Regards
Shiv
 
Rahul Bhattacharjee
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can think of some workaround , but only if you know how exactly is the login process works for your application and at which point of the flow those data's are being stored in the session.
 
Rahul Bhattacharjee
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Rahul Bhattacharjee:
You can think of some workaround , but only if you know how exactly is the login process works for your application and at which point of the flow those data's are being stored in the session.


Consider the following situation.The required data is being set in the session and the user ID is also set in the session (or the user ID you can get from the data that is stored in the session).

Now considering the above sitiation you can create a session listner , so just before the session is destroyed , you can take that data from the session and store it in the application context with the user name as the key.
Now after the relogin , if you find that the data which you expected to be in the session is not there , then you might look into the servlet context with the username as the key.If you get any object then put that back into the session and remove the data from the servlet context.
(purely based on assumptions.)
 
ShivPrakash Srivastava
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Rahul,

Sorry for the late response.
I can put the object in the servletContext,but since the servletContext is retrieved from the session,will it not expire when the session expires.Also if I have more than one object stored in session how can I use the userId for two session objects.This will probably not work.

Any other way to persist data within multiple sessions?

Thanks and Regards
Shiv
 
ShivPrakash Srivastava
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Rahul,

Sorry for the late response.
I can put the object in the servletContext,but since the servletContext is retrieved from the session,will it not expire when the session expires.Also if I have more than one object stored in session how can I use the userId for two session objects.This will probably not work.

Any other way to persist data within multiple sessions?

Thanks and Regards
Shiv
 
Stephen Ma
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm in the same situation and wonder whether anybody found a solution to this problem.

Thanks!
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!