Package com.ocpsoft.pretty.faces.config

Examples of com.ocpsoft.pretty.faces.config.PrettyConfig


      }
   }

   private boolean isPrettyNavigationCase(final PrettyContext prettyContext, final String action)
   {
      PrettyConfig config = prettyContext.getConfig();
      return (action != null) && config.isMappingId(action) && action.trim().startsWith(PrettyContext.PRETTY_PREFIX);
   }
View Full Code Here


      Assert.notNull(request, "HttpServletRequest argument was null");

      config = (PrettyConfig) request.getAttribute(CONFIG_KEY);
      if (config == null)
      {
         config = new PrettyConfig();
      }

      contextPath = request.getContextPath();
      String requestUrl = stripContextPath(request.getRequestURI());
      if (requestUrl.matches(JSESSIONID_REGEX))
View Full Code Here

   {
      if ((servletContext == null) || (servletContext.getAttribute(PrettyContext.CONFIG_KEY) == null))
      {
         log.warn("PrettyFilter is not registered in web.xml, but is registered with JSF "
                  + "Navigation and Action handlers -- this could cause unpredictable behavior.");
         return new PrettyConfig();
      }
      return (PrettyConfig) servletContext.getAttribute(PrettyContext.CONFIG_KEY);
   }
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().toURL() + query.toQueryString();
            log.trace("Refreshing requested page [" + url + "]");
            String redirectUrl = externalContext.encodeRedirectURL(target, null);
            externalContext.redirect(redirectUrl);
            return true;
         }
         else if (isPrettyNavigationCase(prettyContext, action))
         {
            UrlMapping mapping = config.getMappingById(action);
            if (mapping != null)
            {
               String url = contextPath + builder.buildURL(mapping).encode()
                        + builder.buildQueryString(mapping).toString();
               log.trace("Redirecting to mappingId [" + mapping.getId() + "], [" + url + "]");
View Full Code Here

      }
   }

   private boolean isPrettyNavigationCase(PrettyContext prettyContext, final String action)
   {
      PrettyConfig config = prettyContext.getConfig();
      return (action != null) && config.isMappingId(action) && action.trim().startsWith(PrettyContext.PRETTY_PREFIX);
   }
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;
      }
      else if ((outcome != null) && outcome.startsWith(PrettyContext.PRETTY_PREFIX) && config.isMappingId(outcome))
      {
         /*
          * FIXME this will not work with dynamic view IDs... figure out another solution
          * (<rewrite-view>/faces/views/myview.xhtml</rewrite-view> ? For now. Do not support it.
          */
         UrlMapping mapping = config.getMappingById(outcome);
         String viewId = mapping.getViewId();
         if (mapping.isDynaView())
         {
            viewId = dynaview.calculateDynaviewId(context, mapping);
         }
View Full Code Here

         throw new PrettyException("Mapping id was null when attempting to build URL for component: "
                  + component.toString() + " <" + component.getClientId(context) + ">");
      }

      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));

      context.getExternalContext().getRequestMap().put(var, href);
View Full Code Here

        if(beanManager == null)
            beanManager = new BeanManagerLocator().getBeanManager();
       
        ViewConfigStore store = BeanManagerUtils.getContextualInstance(beanManager, ViewConfigStore.class);
        List<UrlMapping> mappings = loadUrlMappings(store, webXmlParser.getFacesMapping());
        PrettyConfig prettyConfig = new PrettyConfig();
        prettyConfig.setMappings(mappings);
        return prettyConfig;
    }
View Full Code Here

TOP

Related Classes of com.ocpsoft.pretty.faces.config.PrettyConfig

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.