* @see org.apache.wicket.request.IRequestHandler#respond(org.apache.wicket.request.IRequestCycle)
*/
@Override
public void respond(final IRequestCycle requestCycle)
{
final IRequestablePage page = getPage();
final boolean freshPage = pageComponentProvider.isPageInstanceFresh();
final boolean isAjax = ((WebRequest)requestCycle.getRequest()).isAjax();
IRequestableComponent component;
try
{
component = getComponent();
}
catch (ComponentNotFoundException e)
{
// either the page is stateless and the component we are looking for is not added in the
// constructor
// or the page is stateful+stale and a new instances was created by pageprovider
// we denote this by setting component to null
component = null;
}
if ((component == null && !freshPage) || (component != null && component.getPage() != page))
{
throw new ComponentNotFoundException("Component '" + getComponentPath()
+ "' has been removed from page.");
}
if (page instanceof Page)
{
// initialize the page to be able to check whether it is stateless
((Page)page).internalInitialize();
}
final boolean isStateless = page.isPageStateless();
RedirectPolicy policy = isStateless
? RedirectPolicy.NEVER_REDIRECT
: RedirectPolicy.AUTO_REDIRECT;
final IPageProvider pageProvider = new PageProvider(page);