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

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


      preProcessors = Collections.unmodifiableList(temp);
   }

   public static PathParameter process(final String expression)
   {
      PathParameter result = new PathParameter();
      result.setExpression(new ConstantExpression(expression));

      for (PathParameterProcessor p : preProcessors)
      {
         result = p.process(result);
      }
View Full Code Here


   private static final String REGEX = "\\#\\{\\s*(\\w+)\\s*:\\s*([\\w\\.]{1,})\\s*\\}";
   public static final Pattern pattern = Pattern.compile(REGEX);

   public PathParameter process(final PathParameter param)
   {
      PathParameter result = param.copy();

      Matcher matcher = pattern.matcher(param.getExpression().getELExpression());
      if (matcher.matches())
      {
         String name = matcher.group(1);
         String el = matcher.group(2);

         result.setExpression(new ConstantExpression("#{" + el + "}"));
         result.setName(name);
         result.setExpressionIsPlainText(false);
      }
      return result;
   }
View Full Code Here

   private static final String REGEX = "\\#\\{\\s*:?\\s*([\\w\\.]+)\\s*\\}";
   public static final Pattern pattern = Pattern.compile(REGEX);

   public PathParameter process(final PathParameter param)
   {
      PathParameter result = param.copy();

      Matcher matcher = pattern.matcher(param.getExpression().getELExpression());
      if (matcher.matches())
      {
         String el = matcher.group(1);
         result.setExpression(new ConstantExpression("#{" + el + "}"));
         result.setExpressionIsPlainText(false);
      }
      return result;
   }
View Full Code Here

   private static final String REGEX = "\\#\\{\\s*(\\w+)\\s*\\}";
   public static final Pattern pattern = Pattern.compile(REGEX);

   public PathParameter process(final PathParameter param)
   {
      PathParameter result = param.copy();

      Matcher matcher = pattern.matcher(param.getExpression().getELExpression());
      if (matcher.matches())
      {
         String name = matcher.group(1);
         result.setName(name);
         result.setExpressionIsPlainText(false);
      }
      return result;
   }
View Full Code Here

public class PlainText implements PathParameterProcessor
{

   public PathParameter process(final PathParameter param)
   {
      PathParameter result = param.copy();
      if (result.expressionIsPlainText())
      {
         result.setRegex(result.getExpression().getELExpression());
      }
      return result;
   }
View Full Code Here

public class PathParameterTest
{
    @Test
    public void testIsNamedFalseWhenNameNull()
    {
        PathParameter parameter = new PathParameter();
        assertFalse(parameter.isNamed());
    }
View Full Code Here

    }

    @Test
    public void testIsNamedFalseWhenNameEmpty()
    {
        PathParameter parameter = new PathParameter();
        parameter.setName("");
        assertFalse(parameter.isNamed());
    }
View Full Code Here

    }

    @Test
    public void testIsNamedTrueWhenNameSet()
    {
        PathParameter parameter = new PathParameter();
        parameter.setName("name");
        assertTrue(parameter.isNamed());
    }
View Full Code Here

   @Test
   public void testSpacing1() throws Exception
   {
      String expression = "#{/test/name}";
      PathParameter param = new PathParameter();
      param.setExpression(expression);
      param = p.process(param);

      assertEquals("#{name}", param.getExpression().getELExpression());
      assertEquals("test", param.getRegex());
   }
View Full Code Here

   @Test
   public void testSpacing2() throws Exception
   {
      String expression = "#{ /test/ name:point}";
      PathParameter param = new PathParameter();
      param.setExpression(expression);
      param = p.process(param);

      assertEquals("#{name:point}", param.getExpression().getELExpression());
      assertEquals("test", param.getRegex());
   }
View Full Code Here

TOP

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

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.