Package com.ocpsoft.pretty

Examples of com.ocpsoft.pretty.PrettyContext


   {
      log.debug("Navigation requested: fromAction [" + fromAction + "], outcome [" + outcome + "]");
      if (!pr.redirect(context, outcome))
      {
         log.debug("Not a PrettyFaces navigation string - passing control to default nav-handler");
         PrettyContext prettyContext = PrettyContext.getCurrentInstance(context);
         prettyContext.setInNavigation(true);

         String originalViewId = context.getViewRoot().getViewId();
         parent.handleNavigation(context, fromAction, outcome);
         String newViewId = context.getViewRoot().getViewId();

         /*
          * Navigation is complete if the viewId has not changed or the response is complete
          */
         if ((true == context.getResponseComplete()) || originalViewId.equals(newViewId))
         {

            prettyContext.setInNavigation(false);
         }
      }

   }
View Full Code Here


      }

      try
      {

         PrettyContext prettyContext = PrettyContext.getCurrentInstance(context);
         PrettyConfig prettyConfig = prettyContext.getConfig();
         UrlMapping urlMapping = prettyConfig.getMappingById(mappingId);

         String href = context.getExternalContext().getRequestContextPath()
               + urlBuilder.build(urlMapping, true, urlBuilder.extractParameters(component));
View Full Code Here

   }

   @Override
   public NavigationCase getNavigationCase(final FacesContext context, final String fromAction, final String outcome)
   {
      PrettyContext prettyContext = PrettyContext.getCurrentInstance(context);
      PrettyConfig config = prettyContext.getConfig();
      if ((outcome != null) && PrettyContext.PRETTY_PREFIX.equals(outcome))
      {
         String viewId = context.getViewRoot().getViewId();
         NavigationCase navigationCase = parent.getNavigationCase(context, fromAction, viewId);
         return navigationCase;
View Full Code Here

   public void beforePhase(final PhaseEvent event)
   {
      FacesContext facesContext = event.getFacesContext();
      if (PhaseId.RESTORE_VIEW.equals(event.getPhaseId()))
      {
         PrettyContext prettyContext = PrettyContext.getCurrentInstance(facesContext);
         if (prettyContext.shouldProcessDynaview())
         {
            // We are only using this lifecycle to access the EL-Context.
            // End the faces lifecycle and finish processing after the Phase
            UIViewRoot viewRoot = facesContext.getViewRoot();
            if (viewRoot == null)
View Full Code Here

   public void afterPhase(final PhaseEvent event)
   {
      if (PhaseId.RESTORE_VIEW.equals(event.getPhaseId()))
      {
         PrettyContext prettyContext = PrettyContext.getCurrentInstance(event.getFacesContext());
         boolean dynaviewViewDetermination = prettyContext.shouldProcessDynaview();

         /*
          * Validate and inject path/query parameter if one of these conditions is met:
          *   - The 'responseComplete' flag is not set (normal mapped request)
          *   - we must evaluate the view id for a dynaview request (responseComplete is set!!!)
View Full Code Here

   private void processEvent(final PhaseEvent event)
   {
      FacesContext context = event.getFacesContext();

      PrettyContext prettyContext = PrettyContext.getCurrentInstance(context);
      UrlMapping mapping = prettyContext.getCurrentMapping();
      if (mapping != null)
      {
         executor.executeActions(context, event.getPhaseId(), mapping);
      }
   }
View Full Code Here

   private static final FacesElUtils elUtils = new FacesElUtils();

   public void validateParameters(final FacesContext context)
   {
      log.trace("Validating parameters.");
      PrettyContext prettyContext = PrettyContext.getCurrentInstance(context);
      URL url = prettyContext.getRequestURL();
      UrlMapping mapping = prettyContext.getCurrentMapping();

      if (mapping != null)
      {
         validatePathParams(context, url, mapping);
         validateQueryParams(context, mapping);
View Full Code Here

                  + component.toString() + " <" + component.getClientId(context) + ">");
      }
     
      String relative = (String) urlBuffer.getAttributes().get("relative");

      PrettyContext prettyContext = PrettyContext.getCurrentInstance(context);
      PrettyConfig prettyConfig = prettyContext.getConfig();
      UrlMapping urlMapping = prettyConfig.getMappingById(mappingId);

      String prettyHref = urlBuilder.build(urlMapping, true, urlBuilder.extractParameters(component));
      String contextPath = context.getExternalContext().getRequestContextPath();
      String href = (relative == null || "false".equals(relative)) ? contextPath + prettyHref : prettyHref;
View Full Code Here

   public boolean redirect(final FacesContext context, final String action)
   {
      try
      {
         PrettyContext prettyContext = PrettyContext.getCurrentInstance(context);
         PrettyConfig config = prettyContext.getConfig();
         ExternalContext externalContext = context.getExternalContext();
         String contextPath = prettyContext.getContextPath();
         if (PrettyContext.PRETTY_PREFIX.equals(action) && prettyContext.isPrettyRequest())
         {
            URL url = prettyContext.getRequestURL();
            QueryString query = prettyContext.getRequestQueryString();

            String target = contextPath + url.encode() + query.toQueryString();
            log.trace("Refreshing requested page [" + url + "]");
            encodeURL(externalContext, config, target);
            return true;
View Full Code Here

   public void beforePhase(final PhaseEvent event)
   {
      FacesContext facesContext = event.getFacesContext();
      if (PhaseId.RESTORE_VIEW.equals(event.getPhaseId()))
      {
         PrettyContext prettyContext = PrettyContext.getCurrentInstance(facesContext);
         if (prettyContext.shouldProcessDynaview())
         {
            // We are only using this lifecycle to access the EL-Context.
            // End the faces lifecycle and finish processing after the Phase
            UIViewRoot viewRoot = facesContext.getViewRoot();
            if (viewRoot == null)
View Full Code Here

TOP

Related Classes of com.ocpsoft.pretty.PrettyContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.