File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

session.getLastAccessedTime() = -1 ??

 
Rich Smyth
Ranch Hand
Posts: 87
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a HttpSession object called session.
Why would session.getLastAccessedTime() and session.getCreationTime() return -1. What does -1 represent? Is my session in some weird state? I cannot find a reference to this return value in the API Doc. (btw, session.isNew == true).
TIA
Rich
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13047
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would say that -1 means there was no previous access - perfectly logical since the session is new.
 
Rich Smyth
Ranch Hand
Posts: 87
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry, please let me start again.
session.isNew() == false
(I said the opposite in my original post)
Does session.getCreationTime() == -1 mean that the session has not been created yet?
Rich
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13047
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Now I'm mystified... according to the source code, a new HttpSession should have a creation time of 0. The only place -1 appears is for the initial value of:
maxInactiveInterval = -1;
Bill
 
Rich Smyth
Ranch Hand
Posts: 87
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mystery Solved.
Bill's response prompted me to take a closer look at my session object.
Turns out my session is a StrutsTestCase (servletUnit) implementation of HttpSession. In that implementation, called HttpSessionSimulator, getCreationTime() and getLastAccessTime() always return -1 for valid sessions!
Thanks Bill,
Rich
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic