You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Flying Lee <sk...@hotmail.com> on 2004/09/03 05:37:51 UTC

why tapestry create session continually in the same browser?

Hi, all
    It's something puzzle me very much.

    I has a ProtectedPage:

public class ProtectedPage
 extends BasePage
 implements PageValidateListener {

 /**
  * @see
org.apache.tapestry.event.PageValidateListener#pageValidate(org.apache.tapes
try.event.PageEvent)
  */
 public void pageValidate(PageEvent event) {
  Visit visit = (Visit)this.getVisit();

  if(visit != null && visit.isLogin())
   return;

  LoginPage lp = (LoginPage)event.getRequestCycle().getPage("LoginPage");
  lp.setCallback(new PageCallback(this));
  throw new PageRedirectException(lp);
 }

}

   Open a new browser,visit this protected page,from the HttpSessionListener
,I can know tapestry create a new session object. Before session time
out,visit this page again in the same browser,tapestry don't create new
session again.

   But after session time out,In the same browser,visit the page
again,tapestry create a new session. visit the page in the same browser
continually,tapestry create new session continually too.Why it happen?

   I debug tapestry code,the getVisit() method cause tapestry create session
use "_request.getSession(true)".
   Second time, ApplicationServlet's doService() method called again,I found
that request.getSession(false) is null,why? The first call
"_request.getSession(true)" is totally inoperative ?

   Thanks very much.

   Flying.Lee




---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: why tapestry create session continually in the same browser?

Posted by Adam Greene <ag...@iq-2000.com>.
I was seeing this problem happen quite a bit when using Tomcat 4.0.* 
under Windows 2000, and the simple fix to the problem was to reboot the 
computer :-)   Sun Java under Windows can begin to behave funny if you 
have had Windows up and running too long (I've even seen it happen under 
Windows XP, like, yesterday.  I had an error coming up:  Invalid 
argument, expected class: Class1, found: Class1).

Flying Lee wrote:

>Hi, all
>    It's something puzzle me very much.
>
>    I has a ProtectedPage:
>
>public class ProtectedPage
> extends BasePage
> implements PageValidateListener {
>
> /**
>  * @see
>org.apache.tapestry.event.PageValidateListener#pageValidate(org.apache.tapes
>try.event.PageEvent)
>  */
> public void pageValidate(PageEvent event) {
>  Visit visit = (Visit)this.getVisit();
>
>  if(visit != null && visit.isLogin())
>   return;
>
>  LoginPage lp = (LoginPage)event.getRequestCycle().getPage("LoginPage");
>  lp.setCallback(new PageCallback(this));
>  throw new PageRedirectException(lp);
> }
>
>}
>
>   Open a new browser,visit this protected page,from the HttpSessionListener
>,I can know tapestry create a new session object. Before session time
>out,visit this page again in the same browser,tapestry don't create new
>session again.
>
>   But after session time out,In the same browser,visit the page
>again,tapestry create a new session. visit the page in the same browser
>continually,tapestry create new session continually too.Why it happen?
>
>   I debug tapestry code,the getVisit() method cause tapestry create session
>use "_request.getSession(true)".
>   Second time, ApplicationServlet's doService() method called again,I found
>that request.getSession(false) is null,why? The first call
>"_request.getSession(true)" is totally inoperative ?
>
>   Thanks very much.
>
>   Flying.Lee
>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
>
>  
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: why tapestry create session continually in the same browser?

Posted by Flying Lee <sk...@hotmail.com>.
These are the debug information at the break point set to
ApplicationService.doService() method's first line.

request.getCookies() = Cookie[3]

[0] = Cookie
      name = "JSESSIONID"
      value= "AF5DFAFCC777512EE8D56177F81AD391"
[1] = Cookie
      name = "JSESSIONID"
      value= "507300231639476248E050D1A1C04E97"
[2] = Cookie
      name = "mainMenu2"
      value= ""

request.isRequestedSessionIdValid() = "false"

Each time visit to the page,the Second Cookie's value is different .

I think this is the key of the question! Why it has two Cookie with the same
name?

"Flying Lee" <sk...@hotmail.com> д����Ϣ����
:ch8vod$5cv$1@sea.gmane.org...
> In addition,keep the same browser open.I restart the application
server,and
> Each visit to the page produced one new session .
> "Flying Lee" <sk...@hotmail.com> д����Ϣ����
> :ch8qs5$tv6$1@sea.gmane.org...
> >    By the way,After redirect to LoginPage,I login and update visit
> object's
> > value : "visit.setLogin(true)" . After session time out,The strange
things
> > is happens .
> >    I found that if I can't change the visit's value, It's not the
strange
> > things happens!!!!Everything is normal!
> >
> >
> > "Flying Lee" <sk...@hotmail.com> д����Ϣ����
> > :ch8ouh$r8a$1@sea.gmane.org...
> > > Hi, all
> > >     It's something puzzle me very much.
> > >
> > >     I has a ProtectedPage:
> > >
> > > public class ProtectedPage
> > >  extends BasePage
> > >  implements PageValidateListener {
> > >
> > >  /**
> > >   * @see
> > >
> >
>
org.apache.tapestry.event.PageValidateListener#pageValidate(org.apache.tapes
> > > try.event.PageEvent)
> > >   */
> > >  public void pageValidate(PageEvent event) {
> > >   Visit visit = (Visit)this.getVisit();
> > >
> > >   if(visit != null && visit.isLogin())
> > >    return;
> > >
> > >   LoginPage lp =
> (LoginPage)event.getRequestCycle().getPage("LoginPage");
> > >   lp.setCallback(new PageCallback(this));
> > >   throw new PageRedirectException(lp);
> > >  }
> > >
> > > }
> > >
> > >    Open a new browser,visit this protected page,from the
> > HttpSessionListener
> > > ,I can know tapestry create a new session object. Before session time
> > > out,visit this page again in the same browser,tapestry don't create
new
> > > session again.
> > >
> > >    But after session time out,In the same browser,visit the page
> > > again,tapestry create a new session. visit the page in the same
browser
> > > continually,tapestry create new session continually too.Why it happen?
> > >
> > >    I debug tapestry code,the getVisit() method cause tapestry create
> > session
> > > use "_request.getSession(true)".
> > >    Second time, ApplicationServlet's doService() method called again,I
> > found
> > > that request.getSession(false) is null,why? The first call
> > > "_request.getSession(true)" is totally inoperative ?
> > >
> > >    Thanks very much.
> > >
> > >    Flying.Lee
> > >
> > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> > >
> > >
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> >
> >
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>




---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: why tapestry create session continually in the same browser?

Posted by Flying Lee <sk...@hotmail.com>.
In addition,keep the same browser open.I restart the application server,and
Each visit to the page produced one new session .
"Flying Lee" <sk...@hotmail.com> д����Ϣ����
:ch8qs5$tv6$1@sea.gmane.org...
>    By the way,After redirect to LoginPage,I login and update visit
object's
> value : "visit.setLogin(true)" . After session time out,The strange things
> is happens .
>    I found that if I can't change the visit's value, It's not the strange
> things happens!!!!Everything is normal!
>
>
> "Flying Lee" <sk...@hotmail.com> д����Ϣ����
> :ch8ouh$r8a$1@sea.gmane.org...
> > Hi, all
> >     It's something puzzle me very much.
> >
> >     I has a ProtectedPage:
> >
> > public class ProtectedPage
> >  extends BasePage
> >  implements PageValidateListener {
> >
> >  /**
> >   * @see
> >
>
org.apache.tapestry.event.PageValidateListener#pageValidate(org.apache.tapes
> > try.event.PageEvent)
> >   */
> >  public void pageValidate(PageEvent event) {
> >   Visit visit = (Visit)this.getVisit();
> >
> >   if(visit != null && visit.isLogin())
> >    return;
> >
> >   LoginPage lp =
(LoginPage)event.getRequestCycle().getPage("LoginPage");
> >   lp.setCallback(new PageCallback(this));
> >   throw new PageRedirectException(lp);
> >  }
> >
> > }
> >
> >    Open a new browser,visit this protected page,from the
> HttpSessionListener
> > ,I can know tapestry create a new session object. Before session time
> > out,visit this page again in the same browser,tapestry don't create new
> > session again.
> >
> >    But after session time out,In the same browser,visit the page
> > again,tapestry create a new session. visit the page in the same browser
> > continually,tapestry create new session continually too.Why it happen?
> >
> >    I debug tapestry code,the getVisit() method cause tapestry create
> session
> > use "_request.getSession(true)".
> >    Second time, ApplicationServlet's doService() method called again,I
> found
> > that request.getSession(false) is null,why? The first call
> > "_request.getSession(true)" is totally inoperative ?
> >
> >    Thanks very much.
> >
> >    Flying.Lee
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> >
> >
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>




---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: why tapestry create session continually in the same browser?

Posted by Flying Lee <sk...@hotmail.com>.
   By the way,After redirect to LoginPage,I login and update visit object's
value : "visit.setLogin(true)" . After session time out,The strange things
is happens .
   I found that if I can't change the visit's value, It's not the strange
things happens!!!!Everything is normal!


"Flying Lee" <sk...@hotmail.com> д����Ϣ����
:ch8ouh$r8a$1@sea.gmane.org...
> Hi, all
>     It's something puzzle me very much.
>
>     I has a ProtectedPage:
>
> public class ProtectedPage
>  extends BasePage
>  implements PageValidateListener {
>
>  /**
>   * @see
>
org.apache.tapestry.event.PageValidateListener#pageValidate(org.apache.tapes
> try.event.PageEvent)
>   */
>  public void pageValidate(PageEvent event) {
>   Visit visit = (Visit)this.getVisit();
>
>   if(visit != null && visit.isLogin())
>    return;
>
>   LoginPage lp = (LoginPage)event.getRequestCycle().getPage("LoginPage");
>   lp.setCallback(new PageCallback(this));
>   throw new PageRedirectException(lp);
>  }
>
> }
>
>    Open a new browser,visit this protected page,from the
HttpSessionListener
> ,I can know tapestry create a new session object. Before session time
> out,visit this page again in the same browser,tapestry don't create new
> session again.
>
>    But after session time out,In the same browser,visit the page
> again,tapestry create a new session. visit the page in the same browser
> continually,tapestry create new session continually too.Why it happen?
>
>    I debug tapestry code,the getVisit() method cause tapestry create
session
> use "_request.getSession(true)".
>    Second time, ApplicationServlet's doService() method called again,I
found
> that request.getSession(false) is null,why? The first call
> "_request.getSession(true)" is totally inoperative ?
>
>    Thanks very much.
>
>    Flying.Lee
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>




---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org