You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by david joffrin <da...@hotmail.com> on 2005/03/11 16:21:52 UTC
Forward context question
Hi,
I am pasting the sample from the javadoc regarding redirect helper
functionality in Tapestry.
public class Home extends BasePage {
public void validate(IRequestCycle cycle) {
Visit visit = (Visit) getVisit();
if (!visit.isAuthenticated()) {
Login login = (Login) cycle.getPage("Login");
login.setCallback(new PageCallback(this));
throw new PageRedirectException(login);
}
}
}
public Login extends BasePage {
private ICallback _callback;
public void setCallback(ICallback _callback) {
_callback = callback;
}
public void formSubmit(IRequestCycle cycle) {
// Authentication code
..
Visit visit = (Visit) getVisit();
visit.setAuthenticated(true);
if (_callback != null) {
_callback.performCallback(cycle);
}
}
}
Imagine now that I go from A to B with some parameters. As I am not logged
in, I go throug hthe login page which then redirects to B afterwards.
How can I ensure that the parameters of the request A->B are kept?
Should I use setServicesParameters?
Thanks.
DvJ
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Forward context question
Posted by Kent Tong <ke...@cpttm.org.mo>.
david joffrin <david_joffrin <at> hotmail.com> writes:
> Imagine now that I go from A to B with some parameters. As I am not logged
> in, I go throug hthe login page which then redirects to B afterwards.
> How can I ensure that the parameters of the request A->B are kept?
> Should I use setServicesParameters?
Use an ExternalCallback instead of a PageCallback. Then page B
must implmenet IExternalPage and implement
activateExternalPage(Object[] parameters, IRequestCycle cycle).
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org