Package com.ocpsoft.pretty

Examples of com.ocpsoft.pretty.PrettyException


      if (m.hasParent() && !seen.contains(m))
      {
         UrlMapping parent = config.getMappingById(m.getParentId());
         if (parent == null)
         {
            throw new PrettyException("Error when building configuration for URL-mapping [" + m.getId() + ":"
                     + m.getPattern() + "] - the requested parentId [" + m.getParentId()
                     + "] does not exist in the configuration.");
         }
         if (parent.hasParent())
         {
View Full Code Here


                  return;
               }
            }
            catch (Exception e)
            {
               throw new PrettyException("Exception occurred while processing <" + mapping.getId() + ":"
                        + action.getAction() + "> " + e.getMessage(), e);
            }
         }
      }
   }
View Full Code Here

      }

      String mappingId = (String) component.getAttributes().get("mappingId");
      if (mappingId == null)
      {
         throw new PrettyException("Mapping id was null when attempting to build URL for component: "
                  + component.toString() + " <" + component.getClientId(context) + ">");
      }

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

         if ((link.getAnchor() != null) && link.getAnchor().length() > 0)
         {
            href += "#" + link.getAnchor();
         }

         writer.writeURIAttribute("href", context.getExternalContext().encodeResourceURL(href), "href");

      }
      catch (PrettyException e)
      {
         throw new PrettyException("Failed to build URL for mapping '" + mappingId
               + "' while rendering <pretty:link> component: " + link.getClientId(context), e);
      }

      writeAttr(writer, "id", link.getClientId(context));
      writeAttr(writer, "accesskey", link.getAccesskey());
View Full Code Here

            // read value of the path parameter
            expression = injection.getExpression().getELExpression();
            value = elUtils.getValue(context, expression);
            if (value == null)
            {
               throw new PrettyException("PrettyFaces: Exception occurred while building URL for MappingId < "
                        + mapping.getId() + " >, Required value " + " < " + expression + " > was null");
            }

            // convert the value to a string using the correct converter
            Converter converter = context.getApplication().createConverter(value.getClass());
            if (converter != null)
            {
               String convertedValue = converter.getAsString(context, new NullComponent(), value);
               if (convertedValue == null)
               {
                  throw new PrettyException("PrettyFaces: The converter <" + converter.getClass().getName()
                           + "> returned null while converting the object <" + value.toString() + ">!");
               }
               value = convertedValue;
            }

            parameterValues.add(value.toString());
         }

         result = parser.getMappedURL(parameterValues).encode();
      }
      catch (ELException e)
      {
         throw new PrettyException("PrettyFaces: Exception occurred while building URL for MappingId < "
                  + mapping.getId() + " >, Error occurred while extracting values from backing bean" + " < "
                  + expression + ":" + value + " >", e);
      }

      return result;
View Full Code Here

         result = QueryString.build(queryParameterValues);
      }
      catch (ELException e)
      {
         throw new PrettyException("PrettyFaces: Exception occurred while building QueryString for MappingId < "
                  + mapping.getId() + " >, Error occurred while extracting values from backing bean" + " < "
                  + expression + ":" + value + " >", e);
      }

      return result;
View Full Code Here

         {
            configParser.parse(builder, is);
         }
         catch (Exception e)
         {
            throw new PrettyException("Failed to parse PrettyFaces configuration from " + configFilePath, e);
         }
         finally
         {
            try
            {
View Full Code Here

                     {
                        configParser.parse(builder, is);
                     }
                     catch (SAXException e)
                     {
                        throw new PrettyException("Failed to parse PrettyFaces configuration from URL:" + url, e);
                     }
                  }
                  finally
                  {
                     if (is != null)
                     {
                        is.close();
                     }
                  }
               }
            }
         }
      }
      catch (Exception e)
      {
         throw new PrettyException("Could not get references to PrettyFaces ClassLoader-configuration elements.", e);
      }
      return builder.build();
   }
View Full Code Here

            response.sendError(HttpServletResponse.SC_NOT_FOUND);
            context.responseComplete();
         }
         catch (IOException e1)
         {
            throw new PrettyException(e1);
         }
      }
   }
View Full Code Here

      String var = (String) urlBuffer.getAttributes().get("var");

      String mappingId = (String) component.getAttributes().get("mappingId");
      if (mappingId == null)
      {
         throw new PrettyException("Mapping id was null when attempting to build URL for component: "
                  + component.toString() + " <" + component.getClientId(context) + ">");
      }
     
      String relative = (String) urlBuffer.getAttributes().get("relative");
View Full Code Here

               inboundUrl = inboundUrl.substring(regionEnd - 1);
            }
            else
            {
               throw new PrettyException("Error parsing url: <" + url
                        + ">, a parameter did not match compiled segment in pattern: " + originalPattern);
            }
         }
      }
      else
View Full Code Here

TOP

Related Classes of com.ocpsoft.pretty.PrettyException

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.