/** * 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. */ protected Throwable buildView(FacesContext context, Throwable throwable, Throwable rootCause) throws IOException { if (context.getViewRoot() == null) { ViewHandler viewHandler = context.getApplication().getViewHandler(); String viewId = viewHandler.deriveViewId(context, ComponentUtils.calculateViewId(context)); ViewDeclarationLanguage vdl = viewHandler.getViewDeclarationLanguage(context, viewId); UIViewRoot viewRoot = vdl.createView(context, viewId); context.setViewRoot(viewRoot); vdl.buildView(context, viewRoot); // Workaround for Mojarra // if UIViewRoot == null -> 'IllegalArgumentException' is throwed instead of 'ViewExpiredException' if (rootCause == null && throwable instanceof IllegalArgumentException) { rootCause = new javax.faces.application.ViewExpiredException(viewId); } } return rootCause; }
@Override public void buildView(FacesContext context, UIViewRoot root) throws IOException { delegate.buildView(context, root); }
@Override public void buildView(FacesContext context, UIViewRoot root) throws IOException { getWrapped().buildView(context, root); }
String viewId = "/path/to/some.xhtml"; FacesContext context = FacesContext.getCurrentInstance(); ViewDeclarationLanguage vdl = context.getApplication().getViewHandler().getViewDeclarationLanguage(context, viewId); UIViewRoot view = vdl.createView(context, viewId); vdl.buildView(context, view); // view should now have children.
@Override public void buildView(FacesContext context, UIViewRoot root) throws IOException { getWrapped().buildView(context, root); }
public void buildView(FacesContext context, UIViewRoot view) throws IOException { getWrapped().buildView(context, view); }
@Override public void buildView(FacesContext context, UIViewRoot root) throws IOException { getWrapped().buildView(context, root); }
@Override public void buildView(FacesContext context, UIViewRoot root) throws IOException { getWrapped().buildView(context, root); }
@Override public void buildView(FacesContext context, UIViewRoot root) throws IOException { getWrapped().buildView(context, root); }
@Override public void buildView(FacesContext context, UIViewRoot root) throws IOException { getWrapped().buildView(context, root); }
@Override public void buildView(FacesContext context, UIViewRoot root) throws IOException { getWrapped().buildView(context, root); }
@Override public void buildView(FacesContext context, UIViewRoot root) throws IOException { getWrapped().buildView(context, root); }
facesContext.getViewRoot().getViewId()); if (vdl != null) { vdl.buildView(facesContext, facesContext.getViewRoot());
facesContext.getViewRoot().getViewId()); if (vdl != null) { vdl.buildView(facesContext, facesContext.getViewRoot());
private void renderErrorPage(final FacesContext facesContext, final String errorPageLocation) throws IOException { final ViewHandler viewHandler = facesContext.getApplication().getViewHandler(); final UIViewRoot viewRoot = viewHandler.createView(facesContext, errorPageLocation); facesContext.setViewRoot(viewRoot); facesContext.getPartialViewContext().setRenderAll(true); final ViewDeclarationLanguage viewDeclarationLanguage = viewHandler .getViewDeclarationLanguage(facesContext, errorPageLocation); viewDeclarationLanguage.buildView(facesContext, viewRoot); facesContext.getApplication().publishEvent(facesContext, PreRenderViewEvent.class, viewRoot); viewDeclarationLanguage.renderView(facesContext, viewRoot); facesContext.responseComplete(); }
/** * Creates and builds a local view for the given view ID independently from the current view. * @param viewId The ID of the view which needs to be created and built. * @return A fully populated component tree of the given view ID. * @throws IOException Whenever something fails at I/O level. This can happen when the given view ID is unavailable or malformed. * @since 2.2 * @see ViewHandler#createView(FacesContext, String) * @see ViewDeclarationLanguage#buildView(FacesContext, UIViewRoot) */ public static UIViewRoot buildView(String viewId) throws IOException { FacesContext context = FacesContext.getCurrentInstance(); String normalizedViewId = normalizeViewId(context, viewId); ViewHandler viewHandler = context.getApplication().getViewHandler(); UIViewRoot view = viewHandler.createView(context, normalizedViewId); FacesContext temporaryContext = new TemporaryViewFacesContext(context, view); try { setContext(temporaryContext); viewHandler.getViewDeclarationLanguage(temporaryContext, normalizedViewId).buildView(temporaryContext, view); } finally { setContext(context); } return view; }
/** * Creates and builds a local view for the given view ID independently from the current view. * @param viewId The ID of the view which needs to be created and built. * @return A fully populated component tree of the given view ID. * @throws IOException Whenever something fails at I/O level. This can happen when the given view ID is unavailable or malformed. * @since 2.2 * @see ViewHandler#createView(FacesContext, String) * @see ViewDeclarationLanguage#buildView(FacesContext, UIViewRoot) */ public static UIViewRoot buildView(String viewId) throws IOException { FacesContext context = FacesContext.getCurrentInstance(); String normalizedViewId = normalizeViewId(context, viewId); ViewHandler viewHandler = context.getApplication().getViewHandler(); UIViewRoot view = viewHandler.createView(context, normalizedViewId); FacesContext temporaryContext = new TemporaryViewFacesContext(context, view); try { setContext(temporaryContext); viewHandler.getViewDeclarationLanguage(temporaryContext, normalizedViewId).buildView(temporaryContext, view); } finally { setContext(context); } return view; }
/** * 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. */ protected Throwable buildView(FacesContext context, Throwable throwable, Throwable rootCause) throws IOException { if (context.getViewRoot() == null) { ViewHandler viewHandler = context.getApplication().getViewHandler(); String viewId = viewHandler.deriveViewId(context, ComponentUtils.calculateViewId(context)); ViewDeclarationLanguage vdl = viewHandler.getViewDeclarationLanguage(context, viewId); UIViewRoot viewRoot = vdl.createView(context, viewId); context.setViewRoot(viewRoot); vdl.buildView(context, viewRoot); // Workaround for Mojarra // if UIViewRoot == null -> 'IllegalArgumentException' is throwed instead of 'ViewExpiredException' if (rootCause == null && throwable instanceof IllegalArgumentException) { rootCause = new javax.faces.application.ViewExpiredException(viewId); } } return rootCause; }
vdl.buildView(context, viewRoot); context.getApplication().publishEvent(context, PreRenderViewEvent.class, viewRoot); vdl.renderView(context, viewRoot);
vdl.buildView(context, viewRoot); context.getApplication().publishEvent(context, PreRenderViewEvent.class, viewRoot); vdl.renderView(context, viewRoot);