|
|||||||||
| Home >> All >> org >> apache >> tapestry >> [ callback overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.apache.tapestry.callback
Class PageCallback

java.lang.Objectorg.apache.tapestry.callback.PageCallback
- All Implemented Interfaces:
- ICallback, java.io.Serializable
- public class PageCallback
- extends java.lang.Object
- implements ICallback
- extends java.lang.Object
Simple callback for returning to a page.
Example usage of PageCallback:
The Home page ensure a user is
authenticated in the IPage.validate(IRequestCycle)>IPage.validate(IRequestCycle) 55
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() org.apache.tapestry.IActionListener
authenticates the user and then invokes ICallback.performCallback(IRequestCycle) 55
to the Home page.
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);
}
}
}
- Since:
- 0.2.9
| Field Summary | |
static com.cortexeb.tools.clover.d |
__CLOVER_59_0
|
private java.lang.String |
_pageName
|
private static long |
serialVersionUID
|
| Constructor Summary | |
PageCallback(org.apache.tapestry.IPage page)
|
|
PageCallback(java.lang.String pageName)
|
|
| Method Summary | |
void |
performCallback(org.apache.tapestry.IRequestCycle cycle)
Invokes IRequestCycle.activate(String)> IRequestCycle.activate(String) 55 to select the previously
identified page as the response page. |
java.lang.String |
toString()
Convert this Object to a human-readable String. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
__CLOVER_59_0
public static com.cortexeb.tools.clover.d __CLOVER_59_0
serialVersionUID
private static final long serialVersionUID
- Since:
- 2.0.4
- See Also:
- Constant Field Values
_pageName
private java.lang.String _pageName
| Constructor Detail |
PageCallback
public PageCallback(java.lang.String pageName)
PageCallback
public PageCallback(org.apache.tapestry.IPage page)
| Method Detail |
toString
public java.lang.String toString()
- Description copied from class:
java.lang.Object - Convert this Object to a human-readable String.
There are no limits placed on how long this String
should be or what it should contain. We suggest you
make it as intuitive as possible to be able to place
it into System.out.println() 55
and such.
It is typical, but not required, to ensure that this method never completes abruptly with a java.lang.RuntimeException.
This method will be called when performing string concatenation with this object. If the result is
null, string concatenation will instead use"null".The default implementation returns
getClass().getName() + "@" + Integer.toHexString(hashCode()).
performCallback
public void performCallback(org.apache.tapestry.IRequestCycle cycle)
- Invokes IRequestCycle.activate(String)>
IRequestCycle.activate(String)55 to select the previously identified page as the response page.- Specified by:
performCallbackin interfaceICallback
|
|||||||||
| Home >> All >> org >> apache >> tapestry >> [ callback overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
org.apache.tapestry.callback.PageCallback