portletName = currentPortletName;
}
if ( portletName == null )
{
throw new JspException( "No portlet to render" );
}
HttpServletResponse response = ( HttpServletResponse ) pageContext.getResponse( );
PortletApplication container = getPortletContainer( );
PortletProxy proxy = ( PortletProxy ) getPortletContainer( ).getPortlet( portletName );
PortletRequestImpl req = new PortletRequestImpl( proxy, request, container.getPortletServiceFactory( ) );
PortletResponseImpl resp = new PortletResponseImpl( proxy, req, response );
PageTag page = (PageTag)findAncestorWithClass( this, PageTag.class );
if ( page == null )
{
throw new JspException( "'portlet' tag MUST be inside a 'page' tag");
}
_portletPageContext.setSkinContextPath( page.getSkinContextPath());
req.setPageContext( _portletPageContext );
proxy.service( req, resp );
pageContext.getOut( ).println( resp.getBuffer( ).toString( ) );
}
return EVAL_PAGE;
}
catch ( IOException io )
{
__log.error( "IO error while rendering the portlet", io );
__log.error( "===============================================" );
throw new JspException( io );
}
catch ( PortletException e )
{
__log.error( "Unexpected error while rendering the portlet", e );
__log.error( "===============================================" );
throw new JspException( e );
}
}