Java Reference
In-Depth Information
The
getSession(boolean create)
Method
public HttpSession getSession(boolean create)
This
getSession()
method returns the session associated with the request. If there is no valid
session and the
boolean
parameter passed in is
true
, it will create a new session.
getSession()
throws no exceptions.
It has one parameter:
•
boolean
C
It returns this value:
•
HttpSession
The
getSession()
Method
public HttpSession getSession()
This
getSession()
method performs the same as the previous
getSession()
method; it just
performs as if it were always passed a
true
value.
getSession()
has no parameters and
throws no exceptions.
It returns this value:
•
HttpSession
The
isRequestedSessionValid()
Method
public boolean isRequestedSessionValid()
The
isRequestedSessionValid()
method returns
true
if the session is valid in the current
context; otherwise, it returns
false
.
isRequestedSessionValid()
has no parameters and
throws no exceptions.
It returns this value:
•
boolean
The
isRequestedSessionFromCookie()
Method
public boolean isRequestedSessionFromCookie()
The
isRequestedSessionFromCookie()
method returns
true
if the session ID from the
request came in as a cookie; otherwise, it returns
false
.
isRequestedSessionFromCookie()
has no parameters and throws no exceptions.
It returns this value:
•
boolean