|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.tapestry.callback.ExternalCallback
public class ExternalCallback
A callback for returning to an IExternalPage
.
Example usage of ExternalCallback:
The External page ensure a user is authenticated in the
IPage.validate(IRequestCycle)
method. If the user is not
authenticated, they are redirected to the Login page, after setting a callback in the Login page.
The Login page formSubmit() IActionListener
authenticates
the user and then invokes ICallback.performCallback(IRequestCycle)
to the External page.
public class External extends BasePage implements IExternalPage { private Integer _itemId; public void validate(IRequestCycle cycle) throws RequestCycleException { Visit visit = (Visit) getVisit(); if (!visit.isAuthenticated()) { Login login = (Login) cycle.getPage("Login"); login.setCallback (new ExternalCallback(this, cycle.getServiceParameters())); throw new PageRedirectException(login); } } public void activateExternalPage(Object[] params, IRequestCycle cycle) throws RequestCycleException { _itemId = (Integer) params[0]; } } 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); } } }
IExternalPage
,
ExternalService
,
Serialized FormConstructor Summary | |
---|---|
ExternalCallback(IExternalPage page,
Object[] parameters)
Creates a new ExternalCallback for the page. |
|
ExternalCallback(String pageName,
Object[] parameters)
Creates a new ExternalCallback for the named IExternalPage. |
Method Summary | |
---|---|
void |
performCallback(IRequestCycle cycle)
Invokes IRequestCycle.activate(org.apache.tapestry.IPage) to select the previously identified
IExternalPage as the response page and activates the page by invoking
activateExternalPage() with the callback parameters and request cycle. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public ExternalCallback(String pageName, Object[] parameters)
public ExternalCallback(IExternalPage page, Object[] parameters)
Method Detail |
---|
public void performCallback(IRequestCycle cycle)
IRequestCycle.activate(org.apache.tapestry.IPage)
to select the previously identified
IExternalPage as the response page and activates the page by invoking
activateExternalPage() with the callback parameters and request cycle.
performCallback
in interface ICallback
public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |