Package com.ocpsoft.pretty.faces.config

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


   @Override
   public PrettyConfig loadConfiguration(ServletContext servletContext)
   {
      final PrettyConfigBuilder builder = new PrettyConfigBuilder();
      PrettyConfigParser configParser = new DigesterPrettyConfigParser();
      final InputStream is = servletContext.getResourceAsStream(DEFAULT_PRETTY_FACES_CONFIG);
      if (is != null)
      {
         log.trace("Reading config [" + DEFAULT_PRETTY_FACES_CONFIG + "].");

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


   @Override
   public PrettyConfig loadConfiguration(ServletContext servletContext)
   {
      final PrettyConfigBuilder builder = new PrettyConfigBuilder();
      PrettyConfigParser configParser = new DigesterPrettyConfigParser();
      final List<String> configFilesList = getConfigFilesList(servletContext);
      for (final String configFilePath : configFilesList)
      {
         final InputStream is = servletContext.getResourceAsStream(configFilePath);
         if (is == null)
         {
            log.error("Pretty Faces config resource [" + configFilePath + "] not found.");
            continue;
         }

         log.trace("Reading config [" + configFilePath + "].");

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

      {
         return null;
      }

      final PrettyConfigBuilder builder = new PrettyConfigBuilder();
      PrettyConfigParser configParser = new DigesterPrettyConfigParser();
      try
      {
         final Enumeration<URL> urls = getClass().getClassLoader().getResources(PRETTY_CONFIG_RESOURCE);
         if (urls != null)
         {
            while (urls.hasMoreElements())
            {
               final URL url = urls.nextElement();
               if (url != null)
               {
                  InputStream is = null;
                  try
                  {
                     is = openStream(url);
                     try
                     {
                        configParser.parse(builder, is);
                     }
                     catch (SAXException e)
                     {
                        throw new PrettyException("Failed to parse PrettyFaces configuration from URL:" + url, e);
                     }
View Full Code Here

   @Test
   public void testParseParentIds() throws Exception
   {

      final PrettyConfigBuilder builder = new PrettyConfigBuilder();
      new DigesterPrettyConfigParser().parse(builder,
               getClass().getClassLoader().getResourceAsStream("parenting-pretty-config.xml"));
      PrettyConfig config = builder.build();

      assertEquals("", config.getMappingById("parent").getParentId());
      assertEquals("parent", config.getMappingById("child").getParentId());
View Full Code Here

   public static final String DEFAULT_PRETTY_FACES_CONFIG = "/WEB-INF/pretty-config.xml";

   public PrettyConfig loadConfiguration(ServletContext servletContext)
   {
      final PrettyConfigBuilder builder = new PrettyConfigBuilder();
      PrettyConfigParser configParser = new DigesterPrettyConfigParser();
      final InputStream is = servletContext.getResourceAsStream(DEFAULT_PRETTY_FACES_CONFIG);
      if (is != null)
      {
         log.trace("Reading config [" + DEFAULT_PRETTY_FACES_CONFIG + "].");

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

   private static final Log log = LogFactory.getLog(ContextSpecifiedConfigurationProvider.class);

   public PrettyConfig loadConfiguration(ServletContext servletContext)
   {
      final PrettyConfigBuilder builder = new PrettyConfigBuilder();
      PrettyConfigParser configParser = new DigesterPrettyConfigParser();
      final List<String> configFilesList = getConfigFilesList(servletContext);
      for (final String configFilePath : configFilesList)
      {
         final InputStream is = servletContext.getResourceAsStream(configFilePath);
         if (is == null)
         {
            log.error("Pretty Faces config resource [" + configFilePath + "] not found.");
            continue;
         }

         log.trace("Reading config [" + configFilePath + "].");

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

      {
         return null;
      }

      final PrettyConfigBuilder builder = new PrettyConfigBuilder();
      PrettyConfigParser configParser = new DigesterPrettyConfigParser();
      try
      {
         final Enumeration<URL> urls = getClass().getClassLoader().getResources(PRETTY_CONFIG_RESOURCE);
         if (urls != null)
         {
            while (urls.hasMoreElements())
            {
               final URL url = urls.nextElement();
               if (url != null)
               {
                  InputStream is = null;
                  try
                  {
                     is = openStream(url);
                     try
                     {
                        configParser.parse(builder, is);
                     }
                     catch (SAXException e)
                     {
                        throw new PrettyException("Failed to parse PrettyFaces configuration from URL:" + url, e);
                     }
View Full Code Here

TOP

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

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.