@SuppressWarnings("unchecked")
@Override
public int doEndTag() throws JspException
{
UIXComponentRef region = (UIXComponentRef) getComponentInstance();
String regionType = region.getComponentType();
if (regionType == null)
{
_LOG.severe("'componentType' attribute is required");
}
else
processRegion:
{
_LOG.finest("componentType is:{0}", regionType);
RegionMetadata rmd =
RegionMetadata.getRegionMetadata(getFacesContext());
ComponentMetaData cmd = (ComponentMetaData) rmd.getRegionConfig(regionType);
if (cmd == null)
{
_LOG.severe("Could not find metadata for componentType:{0} in region-metadata",
regionType);
break processRegion;
}
boolean hasErrors = _typeConvertAndDefaultAttrs(regionType, cmd);
if (hasErrors)
break processRegion;
String page = cmd.getJspUIDef();
_LOG.finest("Including page:{0}", page);
try
{
if (page != null)
{
String oldRegion = (String)
region.getAttributes().put(_REGION_TYPE_ATTRIBUTE, regionType);
if (!regionType.equals(oldRegion))
{
region.getChildren().clear(); // bug 4508595
}
pageContext.getRequest().getRequestDispatcher(page).include(
pageContext.getRequest(), pageContext.getResponse());
}
else