You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by "matthew c. mead" <m-...@goof.com> on 2005/02/22 17:01:16 UTC

ExternalLink to an authenticated page fails?

I've created a BaseAuthenticatedPage class that handles redirection to 
the login page for any class that extends it.  Here is the 
pageValidate() method:

  public void pageValidate(PageEvent event) {
    Visit visit = (Visit) getVisit();
    if (visit.getLoggedInUsername() == null) {
      Login loginPage = (Login) getRequestCycle().getPage("Login");
      loginPage.setPageCallback(new PageCallback(this));
      throw new PageRedirectException(loginPage);
    }
  }

When I try to use this with a page that implements IExternalPage, the 
redirect to the login page happens properly, but the parameters that 
were part of the original URL are lost - when the callback activates the 
implementor of the IExternalPage, its properties are not initialized.

If the user is logged in and has a valid session still, everything works 
as expected (because no page redirection occurs).

It seems like the pageValidate() is cutting off any chance of 
activateExternalPage() being called with the parameters on the original URL.

Has anyone seen this and know a solution?

Thanks!



-matt

-- 
matthew c. mead

http://www.goof.com/

Re: ExternalLink to an authenticated page fails?

Posted by "matthew c. mead" <ma...@goof.com>.
I haven't tried this yet, but after trying a number of ideas like the 
one you suggest, I finally stumbled across this in the API docs:

http://jakarta.apache.org/tapestry/doc/api/org/apache/tapestry/callback/ExternalCallback.html

I will be trying it soon, but it looks like this is the correct answer 
to the issue I was seeing.

Thanks for the help!



-matt

Bryan Lewis wrote:

>I haven't seen exactly this problem... our login component is part of our
>ever-present border so we don't need to redirect the page.  But I remember
>that the order of method calls was a bit of a surprise when I first tried
>IExternalPage.  Tapestry calls activateExternalPage() before it calls our
>border's pageBeginRender().
>
>Maybe there's some order dependency in your case too.  Perhaps your base
>page class could grab the parameters from the URL in activateExternalPage()
>and save them in instance variables, allowing pageValidate() to set them on
>the final page.
>
>
>----- Original Message ----- 
>From: "matthew c. mead" <m-...@goof.com>
>To: "Tapestry users" <ta...@jakarta.apache.org>
>Sent: Tuesday, February 22, 2005 11:01 AM
>Subject: ExternalLink to an authenticated page fails?
>
>
>  
>
>>I've created a BaseAuthenticatedPage class that handles redirection to
>>the login page for any class that extends it.  Here is the
>>pageValidate() method:
>>
>>  public void pageValidate(PageEvent event) {
>>    Visit visit = (Visit) getVisit();
>>    if (visit.getLoggedInUsername() == null) {
>>      Login loginPage = (Login) getRequestCycle().getPage("Login");
>>      loginPage.setPageCallback(new PageCallback(this));
>>      throw new PageRedirectException(loginPage);
>>    }
>>  }
>>
>>When I try to use this with a page that implements IExternalPage, the
>>redirect to the login page happens properly, but the parameters that
>>were part of the original URL are lost - when the callback activates the
>>implementor of the IExternalPage, its properties are not initialized.
>>
>>If the user is logged in and has a valid session still, everything works
>>as expected (because no page redirection occurs).
>>
>>It seems like the pageValidate() is cutting off any chance of
>>activateExternalPage() being called with the parameters on the original
>>    
>>
>URL.
>  
>
>>Has anyone seen this and know a solution?
>>
>>Thanks!
>>
>>
>>
>>-matt
>>
>>-- 
>>matthew c. mead
>>
>>http://www.goof.com/
>>
>>    
>>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>  
>

-- 
matthew c. mead

http://www.goof.com/

Re: ExternalLink to an authenticated page fails?

Posted by Bryan Lewis <br...@maine.rr.com>.
I haven't seen exactly this problem... our login component is part of our
ever-present border so we don't need to redirect the page.  But I remember
that the order of method calls was a bit of a surprise when I first tried
IExternalPage.  Tapestry calls activateExternalPage() before it calls our
border's pageBeginRender().

Maybe there's some order dependency in your case too.  Perhaps your base
page class could grab the parameters from the URL in activateExternalPage()
and save them in instance variables, allowing pageValidate() to set them on
the final page.


----- Original Message ----- 
From: "matthew c. mead" <m-...@goof.com>
To: "Tapestry users" <ta...@jakarta.apache.org>
Sent: Tuesday, February 22, 2005 11:01 AM
Subject: ExternalLink to an authenticated page fails?


> I've created a BaseAuthenticatedPage class that handles redirection to
> the login page for any class that extends it.  Here is the
> pageValidate() method:
>
>   public void pageValidate(PageEvent event) {
>     Visit visit = (Visit) getVisit();
>     if (visit.getLoggedInUsername() == null) {
>       Login loginPage = (Login) getRequestCycle().getPage("Login");
>       loginPage.setPageCallback(new PageCallback(this));
>       throw new PageRedirectException(loginPage);
>     }
>   }
>
> When I try to use this with a page that implements IExternalPage, the
> redirect to the login page happens properly, but the parameters that
> were part of the original URL are lost - when the callback activates the
> implementor of the IExternalPage, its properties are not initialized.
>
> If the user is logged in and has a valid session still, everything works
> as expected (because no page redirection occurs).
>
> It seems like the pageValidate() is cutting off any chance of
> activateExternalPage() being called with the parameters on the original
URL.
>
> Has anyone seen this and know a solution?
>
> Thanks!
>
>
>
> -matt
>
> -- 
> matthew c. mead
>
> http://www.goof.com/
>


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