IPage componentPage = componentPageName == null ? page : cycle.getPage(componentPageName);
IComponent component = componentPage.getNestedComponent(componentId);
IDirect direct = null;
try
{
direct = (IDirect) component;
}
catch (ClassCastException ex)
{
throw new ApplicationRuntimeException(EngineMessages.wrongComponentType(
component,
IDirect.class), component, null, ex);
}
// Check for a StaleSession only when the session was stateful when
// the link was created.
if (activeSession && direct.isStateful())
{
WebSession session = _request.getSession(false);
if (session == null || session.isNew())
throw new StaleSessionException(EngineMessages.requestStateSession(direct),
componentPage);
}
Object[] parameters = _linkFactory.extractListenerParameters(cycle);
cycle.setListenerParameters(parameters);
direct.trigger(cycle);
// Render the response. This will be the active page
// unless the direct component (or its delegate) changes it.
_responseRenderer.renderResponse(cycle);