if (null == page)
{
throw new JetspeedException("Failed to find PSML Pin PageAggregator.build");
}
Fragment root = page.getRootFragment();
if (root == null)
{
throw new JetspeedException("No root Fragment found in Page");
}
String layoutDecorator = root.getDecorator();
if (layoutDecorator == null)
{
layoutDecorator = page.getDefaultDecorator(root.getType());
}
String defaultPortletDecorator = page.getDefaultDecorator(Fragment.PORTLET);
///////////////////////////////////////////////////////////////////////////////////////////////
//TODO: Remove hard coding of locations and use CM + TL
// DST: Im going to encapsulate this into a class, which can be accessed
// by
// the PowerTool when aggregating content, and make sure to modify the
// search path
// according to the current decorator. Assigned issue to JiRa JS2-24
List contentPathes = (List) context.getSessionAttribute(ContentFilter.SESSION_CONTENT_PATH_ATTR);
if (contentPathes == null)
{
contentPathes = new ArrayList(2);
context.setSessionAttribute(ContentFilter.SESSION_CONTENT_PATH_ATTR, contentPathes);
}
String mediaType = context.getCapabilityMap().getPreferredMediaType().getName();
if (contentPathes.size() < 1)
{
// define the lookup order
contentPathes.add(root.getType() + "/" + mediaType + "/" + layoutDecorator);
Iterator defaults = fallBackContentPathes.iterator();
while (defaults.hasNext())
{
String path = (String) defaults.next();
contentPathes.add(path.replaceAll("\\{mediaType\\}", mediaType));
}
}
else
{
contentPathes.set(0, root.getType() + "/" + mediaType + "/" + layoutDecorator);
}
if (layoutDecorator != null)
{
addStyle(context, layoutDecorator, Fragment.LAYOUT);
}
///////////////////////////////////////////////////////////////////////////////////////////////
ContentDispatcher dispatcher = renderer.getDispatcher(context, (strategy == STRATEGY_PARALLEL));
// handle maximized state
NavigationalState nav = context.getPortalURL().getNavigationalState();
PortletWindow window = nav.getMaximizedWindow();
if (null != window)
{
renderMaximizedWindow(context, page, root, window);
}
else
{
aggregateAndRender(root, context, page);
}
//dispatcher.include(root);
context.getResponse().getWriter().write(root.getRenderedContent());
if (null != window)
{
context.getRequest().removeAttribute(PortalReservedParameters.MAXIMIZED_FRAGMENT_ATTRIBUTE);
context.getRequest().removeAttribute(PortalReservedParameters.MAXIMIZED_LAYOUT_ATTRIBUTE);