RenderingContext rc = RenderingContext.getCurrentInstance();
assert (rc != null);
boolean bufferScripts = _requestType == ReqType.LEGACY || _requestType == ReqType.AJAX_LEGACY;
PPRResponseWriter pprWriter =
new PPRResponseWriter(origResponseWriter, rc, bufferScripts);
_context.setResponseWriter(pprWriter);
if (_requestType == ReqType.AJAX)
{
// Add render Ids as partial targets for the request from <f:ajax>
_addRenderIdsAsPartialTargets(rc);
// Force visit-based rendering for the <f:ajax> requests
PartialPageUtils.forceOptimizedPPR(_context);
}
try
{
pprWriter.startDocument();
// Note that PanelPartialRootRenderer will perform partial visit for the optimized PPR
// if it is enabled
_renderChildren(_context, viewRoot);
// PDA's JavaScript DOM is not capable of updating the ViewState just by
// using ViewState's value, so for PDAs, FormRenderer will again render
// the ViewState as a hidden element during its postscript element rendering
if (!CoreRenderer.isPDA(rc))
{
// Always write out ViewState as a separate update element.
String state =
_context.getApplication().getStateManager().getViewState(_context);
pprWriter.writeViewState(state);
}
pprWriter.endDocument();
}
catch (IOException e)
{
// launder the IOException as a FacesException, we'll unwrap this later
throw new FacesException(e);