if (context.getPartialViewContext().isPartialRequest())
{
// try to get (or create) a ResponseSwitch and turn off the output
Object origResponse = context.getExternalContext().getResponse();
ResponseSwitch responseSwitch = ExternalContextUtils.getResponseSwitch(origResponse);
if (responseSwitch == null)
{
// no ResponseSwitch installed yet - create one
responseSwitch = ExternalContextUtils.createResponseSwitch(origResponse);
if (responseSwitch != null)
{
// install the ResponseSwitch
context.getExternalContext().setResponse(responseSwitch);
}
}
if (responseSwitch != null)
{
responseSwitch.setEnabled(context, false);
}
}
ServletResponse response = (ServletResponse) externalContext.getResponse();
ServletRequest request = (ServletRequest) externalContext.getRequest();