IEngineServiceView engine,
IRequestCycle cycle,
ResponseOutputStream output)
throws ServletException, IOException
{
IExternalPage page = null;
String[] context = getServiceContext(cycle.getRequestContext());
if (context == null || context.length != 1)
throw new ApplicationRuntimeException(
Tapestry.format("service-single-context-parameter", Tapestry.EXTERNAL_SERVICE));
String pageName = context[0];
try
{
page = (IExternalPage) cycle.getPage(pageName);
}
catch (ClassCastException ex)
{
throw new ApplicationRuntimeException(
Tapestry.format("ExternalService.page-not-compatible", pageName),
ex);
}
Object[] parameters = getParameters(cycle);
cycle.setServiceParameters(parameters);
cycle.activate(page);
page.activateExternalPage(parameters, cycle);
// Render the response.
engine.renderResponse(cycle, output);
}