congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
ViewHandler
Code IndexAdd Tabnine to your IDE (free)

How to use
ViewHandler
in
javax.faces.application

Best Java code snippets using javax.faces.application.ViewHandler (Showing top 20 results out of 909)

Refine searchRefine arrow

  • Application
  • FacesContext
  • UIViewRoot
  • ExternalContext
  • ViewDeclarationLanguage
origin: primefaces/primefaces

public static String getResourceURL(FacesContext context, String value) {
  if (LangUtils.isValueBlank(value)) {
    return Constants.EMPTY_STRING;
  }
  else if (value.contains(ResourceHandler.RESOURCE_IDENTIFIER)) {
    return value;
  }
  else {
    String url = context.getApplication().getViewHandler().getResourceURL(context, value);
    return context.getExternalContext().encodeResourceURL(url);
  }
}
origin: primefaces/primefaces

@Override
public void handleNavigation(FacesContext context, String fromAction, String outcome) {
  Map<Object, Object> attrs = context.getAttributes();
  String dialogOutcome = (String) attrs.get(Constants.DIALOG_FRAMEWORK.OUTCOME);
    Map<String, String> requestParams = context.getExternalContext().getRequestParameterMap();
    NavigationCase navCase = getNavigationCase(context, fromAction, dialogOutcome);
    String toViewId = navCase.getToViewId(context);
    String url = context.getApplication().getViewHandler().getBookmarkableURL(context, toViewId, params, includeViewParams);
    url = EscapeUtils.forJavaScript(url);
origin: com.liferay.faces/com.liferay.faces.util

@Override
public void resetView(FacesContext facesContext, boolean renderResponse) {
  Application application = facesContext.getApplication();
  ViewHandler viewHandler = application.getViewHandler();
  UIViewRoot viewRoot = facesContext.getViewRoot();
  UIViewRoot emptyView = viewHandler.createView(facesContext, viewRoot.getViewId());
  facesContext.setViewRoot(emptyView);
  if (renderResponse) {
    facesContext.renderResponse();
  }
}
origin: org.icefaces/icefaces-compat

  private static String getAction(FacesContext facesContext) {
    String viewId = facesContext.getViewRoot().getViewId();
    String actionURL = facesContext.getApplication().getViewHandler().
        getActionURL(facesContext, viewId);
    return (facesContext.getExternalContext().encodeActionURL(actionURL));
  }
}
origin: com.sun.faces/jsf-impl

     facesContext.getViewRoot().getViewId());
facesContext.getPartialViewContext();
  ViewHandler vh = facesContext.getApplication().getViewHandler();
     vh.getViewDeclarationLanguage(facesContext,
                      facesContext.getViewRoot().getViewId());
  if (vdl != null) {
    vdl.buildView(facesContext, facesContext.getViewRoot());
    String beforePublishViewId = facesContext.getViewRoot().getViewId();
    facesContext.getApplication().publishEvent(facesContext,
                          PreRenderViewEvent.class,
                          facesContext.getViewRoot());
  vh.renderView(facesContext, facesContext.getViewRoot());
origin: org.omnifaces/omnifaces

ViewHandler viewHandler = context.getApplication().getViewHandler();
UIViewRoot viewRoot = viewHandler.createView(context, viewId);
context.setViewRoot(viewRoot);
context.getPartialViewContext().setRenderAll(true);
Hacks.removeResourceDependencyState(context);
  ViewDeclarationLanguage vdl = viewHandler.getViewDeclarationLanguage(context, viewId);
  vdl.buildView(context, viewRoot);
  context.getApplication().publishEvent(context, PreRenderViewEvent.class, viewRoot);
  vdl.renderView(context, viewRoot);
  context.responseComplete();
  ExternalContext externalContext = context.getExternalContext();
  if (!externalContext.isResponseCommitted()) {
    externalContext.setResponseContentType("text/xml");
    externalContext.getResponseOutputWriter().write(ERROR_PAGE_ERROR);
    context.responseComplete();
origin: org.glassfish/javax.faces

  context.getApplication().createComponent(COMPONENT_TYPE);
ViewHandler outerViewHandler = context.getApplication().getViewHandler();
String renderKitId = outerViewHandler.calculateRenderKitId(context);
ResponseStateManager rsm = RenderKitUtils.getResponseStateManager(context, renderKitId);
    context.setProcessingEvents(true);
    ViewDeclarationLanguage vdl = vdlFactory.getViewDeclarationLanguage(viewId);
    viewRoot = vdl.createView(context, viewId);                
    context.setViewRoot(viewRoot);
    vdl.buildView(context, viewRoot);
    if (!viewRoot.isTransient()) {
      throw new FacesException("Unable to restore view " + viewId);
    context.setProcessingEvents(false);
    ViewDeclarationLanguage vdl = vdlFactory.getViewDeclarationLanguage(viewId);
    viewRoot = vdl.getViewMetadata(context, viewId).createMetadataView(context);
    context.setViewRoot(viewRoot);
    outerViewHandler = context.getApplication().getViewHandler();
    renderKitId = outerViewHandler.calculateRenderKitId(context);
    rsm = RenderKitUtils.getResponseStateManager(context, renderKitId);
    Object[] rawState = (Object[]) rsm.getState(context, viewId);
ViewHandler viewHandler = context.getApplication().getViewHandler();
ViewDeclarationLanguage vdl = viewHandler.getViewDeclarationLanguage(context, viewId);
context.setResourceLibraryContracts(vdl.calculateResourceLibraryContracts(context, viewId));       
origin: org.apache.myfaces.tobago/tobago-deprecation

@Deprecated
public static Locale getLocale(final FacesContext facesContext) {
 final UIViewRoot root = facesContext.getViewRoot();
 final Locale locale;
 if (root != null) {
  locale = root.getLocale();
 } else {
  locale = facesContext.getApplication().getViewHandler().calculateLocale(facesContext);
 }
 return locale;
}
origin: org.omnifaces/omnifaces

/**
 * 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;
}
origin: org.jboss.seam/jboss-seam

protected String baseUrlForContent(String baseName, String extension) {
  if (useExtensions) {
    return baseName + "." + extension;
  } else { 
    FacesContext context = FacesContext.getCurrentInstance();
    ViewHandler handler = context.getApplication().getViewHandler();
    String url = handler.getActionURL(context, 
        DOCSTORE_BASE_URL + Faces.getDefaultSuffix(context));
    return context.getExternalContext().encodeActionURL(url);
  }
}
origin: org.apache.myfaces.core/myfaces-impl

/**
 * @param facesContext
 * @return String A String representing the action URL
 */
protected String getActionUrl(FacesContext facesContext)
{
  ViewHandler viewHandler = facesContext.getApplication().getViewHandler();
  String viewId = facesContext.getViewRoot().getViewId();
  return viewHandler.getActionURL(facesContext, viewId);
}
origin: primefaces/primefaces

url = "#".equals(href) ? "#" : context.getExternalContext().encodeRedirectURL(href, outcomeTarget.getParams());
      && outcomeTarget.isDisableClientWindow()) {
    clientWindow = context.getExternalContext().getClientWindow();
  url = context.getApplication().getViewHandler().getBookmarkableURL(context, toViewId, params, isIncludeViewParams);
origin: org.apache.myfaces.core/myfaces-impl

protected void handleFaceletNotFound(FacesContext context, String viewId) throws FacesException, IOException
{
  String actualId = context.getApplication().getViewHandler().getActionURL(context, viewId);
  context.getExternalContext().responseSendError(HttpServletResponse.SC_NOT_FOUND, actualId);
  context.responseComplete();
}
origin: spring-projects/spring-webflow

private ViewHandler getViewHandler(FacesContext facesContext) {
  ViewHandler viewHandler = facesContext.getApplication().getViewHandler();
  viewHandler.initView(facesContext);
  return viewHandler;
}
origin: org.apache.myfaces/com.springsource.org.apache.myfaces

  public boolean isPostback(FacesContext facesContext)
  {
    ViewHandler viewHandler = facesContext.getApplication().getViewHandler();
    String renderkitId = viewHandler.calculateRenderKitId(facesContext);
    ResponseStateManager rsm = RendererUtils.getResponseStateManager(facesContext, renderkitId);
    return rsm.isPostback(facesContext);
  }
}
origin: org.richfaces.ui.common/richfaces-ui-common-ui

/**
 * Write state saving markers to context, include MyFaces view sequence.
 *
 * @param context
 * @throws IOException
 */
public static void writeState(FacesContext context) throws IOException {
  context.getApplication().getViewHandler().writeState(context);
}
origin: org.apache.myfaces.tobago/tobago-core

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();
}
origin: org.apache.myfaces.core/myfaces-api

public URL getActionURL(FacesContext context) throws MalformedURLException
{
  ExternalContext externalContext = context.getExternalContext();
  return new URL(externalContext.getRequestScheme(), externalContext.getRequestServerName(),
      externalContext.getRequestServerPort(),
      context.getApplication().getViewHandler().getActionURL(context, getToViewId(context)));
}
origin: org.apache.myfaces.core/myfaces-api

public URL getResourceURL(FacesContext context) throws MalformedURLException
{
  ExternalContext externalContext = context.getExternalContext();
  return new URL(externalContext.getRequestScheme(), externalContext.getRequestServerName(),
          externalContext.getRequestServerPort(),
          context.getApplication().getViewHandler().getResourceURL(context, getToViewId(context)));
}

origin: org.apache.myfaces.core/myfaces-api

public URL getBookmarkableURL(FacesContext context) throws MalformedURLException
{
  ExternalContext externalContext = context.getExternalContext();
  return new URL(externalContext.getRequestScheme(),
      externalContext.getRequestServerName(),
      externalContext.getRequestServerPort(),
      context.getApplication().getViewHandler().getBookmarkableURL(context, getToViewId(context), 
          _NavigationUtils.getEvaluatedNavigationParameters(context,
             getParameters()), isIncludeViewParams()));
}
javax.faces.applicationViewHandler

Javadoc

ViewHandler is the pluggablity mechanism for allowing implementations of or applications using the JavaServer Faces specification to provide their own handling of the activities in the Render Response and Restore View phases of the request processing lifecycle. This allows for implementations to support different response generation technologies, as well as alternative strategies for saving and restoring the state of each view. An implementation of this class must be thread-safe.

Please see StateManager for information on how the ViewHandler interacts the StateManager.

Version 2 of the specification formally introduced the concept of View Declaration Language. A View Declaration Language (VDL) is a syntax used to declare user interfaces comprised of instances of JSF UIComponents. Any of the responsibilities of the ViewHandler that specifically deal with the VDL sub-system are now the domain of the VDL implementation. These responsibilities are defined on the ViewDeclarationLanguageclass. The ViewHandler provides #getViewDeclarationLanguage as a convenience method to access the VDL implementation given a viewId.

Most used methods

  • getActionURL
    If the value returned from this method is used as the file argument to the four-argument constructor
  • createView
    Create and return a new UIViewRoot instance initialized with information from the argument FacesCont
  • getResourceURL
    If the value returned from this method is used as the file argument to the four-argument constructor
  • restoreView
    Perform whatever actions are required to restore the view associated with the specified FacesContext
  • calculateRenderKitId
    Return an appropriate renderKitId for this and subsequent requests from the current client. It is an
  • calculateLocale
    Returns an appropriate Locale to use for this and subsequent requests for the current client.
  • writeState
    Take any appropriate action to either immediately write out the current state information (by callin
  • renderView
    Perform whatever actions are required to render the response view to the response object associated
  • initView
    Initialize the view for the request processing lifecycle. This method must be called at the beginni
  • getBookmarkableURL
    Return a JSF action URL derived from the viewId argument that is suitable to be used as the target
  • getViewDeclarationLanguage
    Return the ViewDeclarationLanguage instance used for this ViewHandler instance. The default impleme
  • getRedirectURL
    Return a JSF action URL derived from the viewId argument that is suitable to be used by the Navigat
  • getViewDeclarationLanguage,
  • getRedirectURL,
  • calculateCharacterEncoding,
  • deriveViewId,
  • deriveLogicalViewId,
  • getProtectedViewsUnmodifiable,
  • addProtectedView,
  • getViews,
  • getWebsocketURL,
  • removeProtectedView

Popular in Java

  • Reading from database using SQL prepared statement
  • getResourceAsStream (ClassLoader)
  • requestLocationUpdates (LocationManager)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • SocketTimeoutException (java.net)
    This exception is thrown when a timeout expired on a socket read or accept operation.
  • NumberFormat (java.text)
    The abstract base class for all number formats. This class provides the interface for formatting and
  • ArrayList (java.util)
    ArrayList is an implementation of List, backed by an array. All optional operations including adding
  • Dictionary (java.util)
    Note: Do not use this class since it is obsolete. Please use the Map interface for new implementatio
  • Vector (java.util)
    Vector is an implementation of List, backed by an array and synchronized. All optional operations in
  • JOptionPane (javax.swing)
  • From CI to AI: The AI layer in your organization
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now