You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Yves Sy <yv...@gmail.com> on 2005/03/21 09:35:53 UTC
Visit object instantiation
Hi,
I've read the docs about the Visit object in that it should not be
initialized unless necessary.
Anyway, I put some logs in my app and found out that its being
instantiated when I try to load the initial logon page.
I have the following code in my Login.java class:
/**
* Checks if session exists and user is authenticated. If so,
brings user straight to search page.
* @param e
*/
public void pageBeginRender(PageEvent e) {
logger.debug("ENTERING pageBeginRender");
RMIVisit visit = (RMIVisit) getEngine().getVisit();
logger.debug("VISIT in pageBeginRender: " + visit);
if (visit != null && visit.isAuthenticated()) {
logger.debug("session exists");
throw new PageRedirectException("search");
}
}
According to the docs, getEngine().getVisit() should not initialize a
visit object if none exists. But when I load the logon page, the logs
show that its already been instantiated!
Am I missing something here?
Thanks,
-Yves-
--
A bus station is where a bus stops. A train station is where a train
stops. On my desk I have a work station...
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Visit object instantiation
Posted by Yves Sy <yv...@gmail.com>.
Perfect! I found the part that was instantiating it and it was in the Shell :o)
Thanks,
-Yves-
On Tue, 22 Mar 2005 11:26:32 +0100, Markus Wiederkehr
<ma...@gmail.com> wrote:
> On Tue, 22 Mar 2005 11:17:12 +0100, Markus Wiederkehr
> <ma...@gmail.com> wrote:
> > I took a look into the source code and found out that the only method
> > that ever invokes IEngine.getVisit() is AbstractPage.getVisit().
>
> Just to avoid confusion: I actually meant
> IEngine.getVisit(RequestCycle) not the version without parameters.
>
> Markus
>
--
A bus station is where a bus stops. A train station is where a train
stops. On my desk I have a work station...
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Visit object instantiation
Posted by Markus Wiederkehr <ma...@gmail.com>.
On Tue, 22 Mar 2005 11:17:12 +0100, Markus Wiederkehr
<ma...@gmail.com> wrote:
> I took a look into the source code and found out that the only method
> that ever invokes IEngine.getVisit() is AbstractPage.getVisit().
Just to avoid confusion: I actually meant
IEngine.getVisit(RequestCycle) not the version without parameters.
Markus
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Visit object instantiation
Posted by Markus Wiederkehr <ma...@gmail.com>.
Hi Yves,
I took a look into the source code and found out that the only method
that ever invokes IEngine.getVisit() is AbstractPage.getVisit(). So
the only way the visit object can be created is by invoking the latter
method (either directly or through an OGNL expression). Maybe you
refer to the visit object in the HTML template of your login page?
If you are still not sure what happens you can print a stack trace in
the constructor of your visit object to see from where it gets
invoked. Like this:
try { throw new RuntimeException(); }
catch (RuntimeException e) { e.printStackTrace(); }
hth
Markus
On Mon, 21 Mar 2005 16:35:53 +0800, Yves Sy <yv...@gmail.com> wrote:
> Hi,
>
> I've read the docs about the Visit object in that it should not be
> initialized unless necessary.
>
> Anyway, I put some logs in my app and found out that its being
> instantiated when I try to load the initial logon page.
>
> I have the following code in my Login.java class:
>
> /**
> * Checks if session exists and user is authenticated. If so,
> brings user straight to search page.
> * @param e
> */
> public void pageBeginRender(PageEvent e) {
> logger.debug("ENTERING pageBeginRender");
> RMIVisit visit = (RMIVisit) getEngine().getVisit();
> logger.debug("VISIT in pageBeginRender: " + visit);
> if (visit != null && visit.isAuthenticated()) {
> logger.debug("session exists");
> throw new PageRedirectException("search");
> }
> }
>
> According to the docs, getEngine().getVisit() should not initialize a
> visit object if none exists. But when I load the logon page, the logs
> show that its already been instantiated!
>
> Am I missing something here?
>
> Thanks,
> -Yves-
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Visit object instantiation
Posted by Yves Sy <yv...@gmail.com>.
Hi Cesar,
My login.html has "stateful=false" on the @Form. Are there any other
possible places that could possibly be instatiating it?
Br,
-Yves-
On Mon, 21 Mar 2005 16:12:55 -0800, cesar saenz <ja...@gmail.com> wrote:
> On your login page template(login.html) are you using a @Form
> component? If so, add the following: parameter stateful="ognl:false"
> to it. I believe that by using the @Form component that makes your
> Login page stateful and thus a visit is created. Hope this helps.
>
> Cheers,
> Cesar Saenz
>
>
> On Mon, 21 Mar 2005 16:35:53 +0800, Yves Sy <yv...@gmail.com> wrote:
> > Hi,
> >
> > I've read the docs about the Visit object in that it should not be
> > initialized unless necessary.
> >
> > Anyway, I put some logs in my app and found out that its being
> > instantiated when I try to load the initial logon page.
> >
> > I have the following code in my Login.java class:
> >
> > /**
> > * Checks if session exists and user is authenticated. If so,
> > brings user straight to search page.
> > * @param e
> > */
> > public void pageBeginRender(PageEvent e) {
> > logger.debug("ENTERING pageBeginRender");
> > RMIVisit visit = (RMIVisit) getEngine().getVisit();
> > logger.debug("VISIT in pageBeginRender: " + visit);
> > if (visit != null && visit.isAuthenticated()) {
> > logger.debug("session exists");
> > throw new PageRedirectException("search");
> > }
> > }
> >
> > According to the docs, getEngine().getVisit() should not initialize a
> > visit object if none exists. But when I load the logon page, the logs
> > show that its already been instantiated!
> >
> > Am I missing something here?
> >
> > Thanks,
> > -Yves-
> >
> > --
> > A bus station is where a bus stops. A train station is where a train
> > stops. On my desk I have a work station...
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> >
> >
>
--
A bus station is where a bus stops. A train station is where a train
stops. On my desk I have a work station...
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Visit object instantiation
Posted by cesar saenz <ja...@gmail.com>.
On your login page template(login.html) are you using a @Form
component? If so, add the following: parameter stateful="ognl:false"
to it. I believe that by using the @Form component that makes your
Login page stateful and thus a visit is created. Hope this helps.
Cheers,
Cesar Saenz
On Mon, 21 Mar 2005 16:35:53 +0800, Yves Sy <yv...@gmail.com> wrote:
> Hi,
>
> I've read the docs about the Visit object in that it should not be
> initialized unless necessary.
>
> Anyway, I put some logs in my app and found out that its being
> instantiated when I try to load the initial logon page.
>
> I have the following code in my Login.java class:
>
> /**
> * Checks if session exists and user is authenticated. If so,
> brings user straight to search page.
> * @param e
> */
> public void pageBeginRender(PageEvent e) {
> logger.debug("ENTERING pageBeginRender");
> RMIVisit visit = (RMIVisit) getEngine().getVisit();
> logger.debug("VISIT in pageBeginRender: " + visit);
> if (visit != null && visit.isAuthenticated()) {
> logger.debug("session exists");
> throw new PageRedirectException("search");
> }
> }
>
> According to the docs, getEngine().getVisit() should not initialize a
> visit object if none exists. But when I load the logon page, the logs
> show that its already been instantiated!
>
> Am I missing something here?
>
> Thanks,
> -Yves-
>
> --
> A bus station is where a bus stops. A train station is where a train
> stops. On my desk I have a work station...
>
> ---------------------------------------------------------------------
> 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