public boolean execute(FacesContext facesContext)
{
Application application = facesContext.getApplication();
ViewHandler viewHandler = application.getViewHandler();
UIViewRoot root;
String viewId;
String newViewId;
// JSF 2.0 section 2.2.6: if the current response
// is a partial response, then there must be
// no content written outside of the f:view
// -= Leonardo Uribe =- This section was commented because it
// causes problems when a library try to override the default
// PartialViewContext implementation like trinidad. Since ajax
// stuff is only for facelets, there is no reason to keep this
// code here. Instead, this code was moved to
// JspViewDeclarationLanguage.buildView, because it has more sense
// in that place.
/*
if (facesContext.getPartialViewContext().isPartialRequest())
{
// try to get (or create) a ResponseSwitch and turn off the output
Object response = facesContext.getExternalContext().getResponse();
ResponseSwitch responseSwitch = ExternalContextUtils.getResponseSwitch(response);
if (responseSwitch == null)
{
// no ResponseSwitch installed yet - create one
responseSwitch = ExternalContextUtils.createResponseSwitch(response);
if (responseSwitch != null)
{
// install the ResponseSwitch
facesContext.getExternalContext().setResponse(responseSwitch);
}
}
if (responseSwitch != null)
{
responseSwitch.setEnabled(false);
}
}
*/
try
{
// do-while, because the view might change in PreRenderViewEvent-listeners
do
{
root = facesContext.getViewRoot();
viewId = root.getViewId();
ViewDeclarationLanguage vdl = viewHandler.getViewDeclarationLanguage(
facesContext, viewId);
if (vdl != null)
{