What are the methods in HttpSession and their use?
Answer Posted / kaushal
o getCreationTime()
Returns the time at which this session representation
was created, in milliseconds since midnight, January 1, 1970
UTC.
o getId()
Returns the identifier assigned to this session.
o getLastAccessedTime()
Returns the last time the client sent a request carrying
the identifier assigned to the session.
o getMaxInactiveInterval()
o getSessionContext()
Returns the context in which this session is bound.
Deprecated.
o getValue(String)
Returns the object bound to the given name in the
session's application layer data.
o getValueNames()
Returns an array of the names of all the application
layer data objects bound into the session.
o invalidate()
Causes this representation of the session to be
invalidated and removed from its context.
o isNew()
A session is considered to be "new" if it has been
created by the server, but the client has not yet
acknowledged joining the session.
o putValue(String, Object)
Binds the specified object into the session's
application layer data with the given name.
o removeValue(String)
Removes the object bound to the given name in the
session's application layer data.
o setMaxInactiveInterval(int)
Sets the maximum interval between requests that this
session will be kept by the host server.
| Is This Answer Correct ? | 5 Yes | 2 No |
Post New Answer View All Answers
What must be implemented by all servlets?
When Servlet is unloaded?
What are the advantages of cookies?
What's the architecture of a servlet package?
Whether we can get deadlock situation in servlets?
What are different methods of session management in servlets?
What is servlet configuration?
What do you mean by default initialization in java servlet?
Differentiate between the print writer and servlet output stream?
What are different Authentication options available in Servlets.
What are the steps involved in placing a servlet within a package?
What are the uses of servlet and what is servlet chaining?
How do you deal property files in servlet?
What is the requirement of servlet config and servlet context implemented and how are they implemented?
What is servlet and how it works?