protected String constructRedirectUrl(FacesContext facesContext, String errorPage) {
        String url = facesContext.getExternalContext().getRequestContextPath() + errorPage;

        url = facesContext.getApplication().evaluateExpressionGet(facesContext, url, String.class);
        url = facesContext.getExternalContext().encodeActionURL(url);

        return url;
    }
Builds the view if not already available. This is mostly required for ViewExpiredException's.

@param context The {@link FacesContext}.
@param throwable The occurred {@link Throwable}.
@param rootCause The root cause.
@return The unwrapped {@link Throwable}.
@throws java.io.IOException If building the view fails.
primefaces/src/main/java/org/primefaces/application/exceptionhandler/PrimeExceptionHandler.java