Package com.ocpsoft.pretty.faces.config.mapping

Examples of com.ocpsoft.pretty.faces.config.mapping.UrlMapping


      PrettyContext prettyContext = PrettyContext.getCurrentInstance(context);
      if (!isBookmarkable() && prettyContext.isPrettyRequest() && !prettyContext.isInNavigation() && (viewId != null)
               && viewId.equals(context.getViewRoot().getViewId()))
      {
         ExtractedValuesURLBuilder builder = new ExtractedValuesURLBuilder();
         UrlMapping mapping = prettyContext.getCurrentMapping();
         result = prettyContext.getContextPath() + builder.buildURL(mapping) + builder.buildQueryString(mapping);
      }
      return result;
   }
View Full Code Here


         log.error("Cannot build script because PrettyContext is not available!");
         return null;
      }

      // find UrlMapping in configuration
      UrlMapping mapping = prettyContext.getConfig().getMappingById(mappingId.trim());
      if (mapping == null)
      {
         log.error("Cannot find URL mapping with id: " + mappingId);
         return null;
      }
View Full Code Here

            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 + "]");
               String redirectUrl = externalContext.encodeRedirectURL(url, null);
               externalContext.redirect(redirectUrl);
            }
            else
            {
View Full Code Here

      {
         /*
          * 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);
         }
         viewId = FacesNavigationURLCanonicalizer.normalizeRequestURI(context, viewId);

         URL url = new URL(viewId);
         url.getMetadata().setLeadingSlash(true);
         QueryString qs = QueryString.build("");
         if (viewId.contains("?"))
         {
            qs.addParameters(viewId);
         }
         qs.addParameters("?" + PrettyFacesWrappedResponse.REWRITE_MAPPING_ID_KEY + "=" + mapping.getId());

         viewId = url.toString() + qs.toQueryString();

         NavigationCase navigationCase = parent.getNavigationCase(context, fromAction, viewId);
         return navigationCase;
View Full Code Here

   public void injectParameters(final FacesContext context)
   {
      log.trace("Injecting parameters");
      PrettyContext prettyContext = PrettyContext.getCurrentInstance(context);
      URL url = prettyContext.getRequestURL();
      UrlMapping mapping = prettyContext.getConfig().getMappingForUrl(url);

      if (mapping != null)
      {
         injectPathParams(context, url, mapping);
         injectQueryParams(context, mapping, prettyContext);
View Full Code Here

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

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

                  + 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

        return mappings;
    }
   
    private UrlMapping buildPrettyFacesUrlMapping(String viewId, Annotation annotation, String facesMapping) {
        org.jboss.seam.faces.rewrite.UrlMapping urlMappingAnnotation = (org.jboss.seam.faces.rewrite.UrlMapping) annotation;
        UrlMapping urlMapping = new UrlMapping();
        urlMapping.setViewId(buildViewUrl(viewId, facesMapping));
        urlMapping.setId(viewId);
        urlMapping.setOnPostback(urlMappingAnnotation.onPostback());
        urlMapping.setOutbound(urlMappingAnnotation.outbound());
        urlMapping.setPattern(urlMappingAnnotation.pattern());
        return urlMapping;
    }
View Full Code Here

TOP

Related Classes of com.ocpsoft.pretty.faces.config.mapping.UrlMapping

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.