• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

About the Session

 
Milton Ochoa
Ranch Hand
Posts: 336
Firefox Browser Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Rancher,

I have the next confusion:

On the enthuware simulator. Says:


Your web application logs a user in when she supplies username/password. At that time a session is created for the user. You want to let the user to remain logged in only for 20 minutes. The application should redirect the user to the login page upon any request after 20 minutes of loging in. Which of the following HttpSession methods would be helpful to you for implementing this functionality?

A. getMaxInactiveInterval()
B. getMaxActiveInterval()
C. getLastAccessTime()
D. getLastAccessedTime()
E. getCreationTime()


Without see still the answer, I think that is the D, the correct answer. But thinking again, I think that none of this is a correct approach, that is because, on the HFSJ say that if we call a session method, on a session that is invalidate (in this example for one timeout), this will throws a exception.

I will test this right now, but if someone have a explanation, is welcome

thanks in advance
 
Milton Ochoa
Ranch Hand
Posts: 336
Firefox Browser Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The right answer say that is the E, and explanation make me think, that i was wrong, i misunderstood the question.

But still, I have the same dude, if we call a method on a invalidate session, that will throw a exception?
 
Milton Ochoa
Ranch Hand
Posts: 336
Firefox Browser Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was correct, calling this method getCreationTime() , if the session is invalidate (tested with session.invalidate() method ) the app, will throw a java.lang.IllegalStateException: getCreationTime.

Some one, can tell me, more about that,

very thanks!
 
Balu Sadhasivam
Ranch Hand
Posts: 874
Android Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Your web application logs a user in when she supplies username/password. At that time a session is created for the user. You want to let the user to remain logged in only for 20 minutes. The application should redirect the user to the login page upon any request after 20 minutes of loging in. Which of the following HttpSession methods would be helpful to you for implementing this functionality?


The Question says "any request after 20 minutes of loging in." which is different from "any request after last time access " , hence you got to use getCreationTime() to find the Session creation time and not lastAccesstime
 
Michael Rios
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

The question is about controlling the session within the code and not using any deployment descriptor elements or using setMaxInactiveInterval.

In think its getCreationTime().
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic