tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gary Yang <yga...@yahoo.com>
Subject Re: HttpSession.isNew() Bug?
Date Wed, 01 Mar 2000 19:07:43 GMT
I believe here is a bug.

To fix it, add a line to the end of funciont
org.tomcat.session.StandardSession.access():
this.isNew = false;

i.e. replace file
src/share/org/apache/tomcat/session/StandardSession.java's line 339-349
from

    /**
     * Update the accessed time information for this session.  This
method
     * should be called by the context when a request comes in for a
particular
     * session, even if the application does not reference it.
     */
    public void access() {

        this.lastAccessedTime = this.thisAccessedTime;
        this.thisAccessedTime = System.currentTimeMillis();

    }

to:
   /**
     * Update the accessed time information for this session.  This
method
     * should be called by the context when a request comes in for a
particular
     * session, even if the application does not reference it.
     */
    public void access() {

        this.lastAccessedTime = this.thisAccessedTime;
        this.thisAccessedTime = System.currentTimeMillis();
        this.isNew = false;    // ************this line should be added

    }




Gary Young wrote:

> It seems isNew() always return true in Tomcat 3.1.
> I have tested the function using both JSP and servlet.
> Here is a JSP file:
> <HTML>
> <HEAD>
>         <TITLE>JSP session page</TITLE>
> </HEAD>
> <BODY>
> <%
>         HttpSession ses=request.getSession(true);
>         if(ses.isNew()) {
> %>
> <%=ses.getId()%>
> <%      }
> %>
> </BODY>
> </HTML>
>
> The file always outputs the session's ID when it is
> run
> in Tomcat. However, if the application server is IBM
> WebSphere(2.03 on Linux, and 3.02 on Solaris), it
> ouputs the ID only at the first time.
>
> Why does the function always return true? Is it a bug?
>
> __________________________________________________
> Do You Yahoo!?
> Talk to your friends online with Yahoo! Messenger.
> http://im.yahoo.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


__________________________________________________
Do You Yahoo!?
Talk to your friends online with Yahoo! Messenger.
http://im.yahoo.com

Mime
View raw message