{
final IRequestablePage page = getPage();
final boolean freshPage = pageComponentProvider.isPageInstanceFresh();
final boolean isAjax = ((WebRequest)requestCycle.getRequest()).isAjax();
IRequestableComponent component = null;
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 WicketRuntimeException("Component '" + getComponentPath()
+ "' has been removed from page.");
}