Do you always check the session validity before using it?

Nicolas Silber*zahn

Digital Airways
<100% Java, Mobile, Offline aware>Wapaka Browser for mobile development
(XHTML, WML)</100% Java, Mobile, Offline aware> www.Wapaka.com



-----Message d'origine-----
De : A mailing list for discussion about Sun Microsystem's Java Servlet API
Technology. [mailto:[EMAIL PROTECTED]]De la part de Zerbe John W
Envoyé : vendredi 16 août 2002 19:41
À : [EMAIL PROTECTED]
Objet : Re: Determine if HttpSession is invalid


Even if you use the no parameter getsession(), you can immediately call
isNew() on the returned session.
http://jakarta.apache.org/tomcat/tomcat-4.0-doc/servletapi/javax/servlet/htt
p/HttpSession.html#isNew()
-----Original Message-----
From: Milt Epstein [mailto:[EMAIL PROTECTED]]
Sent: Friday, August 16, 2002 1:33 PM
To: [EMAIL PROTECTED]
Subject: Re: Determine if HttpSession is invalid


On Fri, 16 Aug 2002, Mike Silvers wrote:
> How do I determine if a HttpSession is invalid (not using the
> HttpSessionContext since that has been deprecated)?  I am checking
> to see if the session is null or if the session ID is null and that
> does not work.
>
> What I am trying to accomplish is to check the HttpSession object to
> see if it is invalid.  If it is invalid, I create a new HttpSession
> object with some initialization parameters and use the new
> HttpSession object.
Isn't this what HttpServletRequest.getSession() is for?  See:
http://jakarta.apache.org/tomcat/tomcat-4.0-doc/servletapi/javax/servlet/htt
p/HttpServletRequest.html#getSession(boolean)
Note the role the parameter plays, and the existence of the no
parameter version.
Milt Epstein
Research Programmer
Systems and Technology Services (STS)
Campus Information Technologies and Educational Services (CITES)
University of Illinois at Urbana-Champaign (UIUC)
[EMAIL PROTECTED]
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
*****************************************************************
DISCLAIMER:   The information contained in this e-mail may be confidential
and is intended solely for the use of the named addressee.  Access, copying
or re-use of the e-mail or any information contained therein by any other
person is not authorized.  If you are not the intended recipient please
notify us immediately by returning the e-mail to the originator.

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to