* @since 1.0.2
*/
public void rewindForm(IForm form)
{
IPage page = form.getPage();
String pageName = page.getPageName();
_rewinding = true;
_monitor.pageRewindBegin(pageName);
// Fake things a little for getNextActionId() / isRewound()
// This used to be more involved (and include service parameters, and a parameter
// to this method), when the actionId was part of the Form name. That's not longer
// necessary (no service parameters), and we can fake things here easily enough with
// fixed actionId of 0.
_targetActionId = 0;
_actionId = -1;
_targetComponent = form;
try
{
page.beginPageRender();
form.rewind(NullWriter.getSharedInstance(), this);
// Shouldn't get this far, because the form should
// throw the RenderRewoundException.
throw new StaleLinkException(Tapestry.format("RequestCycle.form-rewind-failure", form
.getExtendedId()), form);
}
catch (RenderRewoundException ex)
{
// This is acceptible and expected.
}
catch (ApplicationRuntimeException ex)
{
// RequestCycleExceptions don't need to be wrapped.
throw ex;
}
catch (Throwable ex)
{
// But wrap other exceptions in a ApplicationRuntimeException ... this
// will ensure that some of the context is available.
throw new ApplicationRuntimeException(ex.getMessage(), page, null, ex);
}
finally
{
page.endPageRender();
_monitor.pageRewindEnd(pageName);
reset();
_rewinding = false;