|
|||||||||
| 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 ExternalCallback

java.lang.Objectorg.apache.tapestry.callback.ExternalCallback
- All Implemented Interfaces:
- ICallback, java.io.Serializable
- public class ExternalCallback
- extends java.lang.Object
- implements ICallback
- extends java.lang.Object
A callback for returning to an org.apache.tapestry.IExternalPage.
Example usage of ExternalCallback:
The External 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 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);
}
}
}
- Since:
- 2.3
| Field Summary | |
static com.cortexeb.tools.clover.d |
__CLOVER_57_0
|
private java.lang.String |
_pageName
|
private java.lang.Object[] |
_parameters
|
| Constructor Summary | |
ExternalCallback(org.apache.tapestry.IExternalPage page,
java.lang.Object[] parameters)
Creates a new ExternalCallback for the page. |
|
ExternalCallback(java.lang.String pageName,
java.lang.Object[] parameters)
Creates a new ExternalCallback for the named IExternalPage. |
|
| Method Summary | |
void |
performCallback(org.apache.tapestry.IRequestCycle cycle)
Invokes IRequestCycle.setPage(String)> IRequestCycle.setPage(String) 55 to select the previously
identified IExternalPage as the response page and activates
the page by invoking activateExternalPage() with the callback
parameters and request cycle. |
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_57_0
public static com.cortexeb.tools.clover.d __CLOVER_57_0
_pageName
private java.lang.String _pageName
_parameters
private java.lang.Object[] _parameters
| Constructor Detail |
ExternalCallback
public ExternalCallback(java.lang.String pageName, java.lang.Object[] parameters)
- Creates a new ExternalCallback for the named IExternalPage.
The parameters (which may be null) is retained, not copied.
ExternalCallback
public ExternalCallback(org.apache.tapestry.IExternalPage page, java.lang.Object[] parameters)
- Creates a new ExternalCallback for the page. The parameters
(which may be null) is retained, not copied.
| Method Detail |
performCallback
public void performCallback(org.apache.tapestry.IRequestCycle cycle)
- Invokes IRequestCycle.setPage(String)>
IRequestCycle.setPage(String)55 to select the previously identified IExternalPage as the response page and activates the page by invoking activateExternalPage() with the callback parameters and request cycle.- Specified by:
performCallbackin interfaceICallback
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()).
|
|||||||||
| 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.ExternalCallback