Examples of RegexConstraint


Examples of org.ocpsoft.rewrite.param.RegexConstraint

                  context.getJavaField().getName());
      }

      // add a corresponding RegexConstraint
      String expr = annotation.value();
      parameterBuilder.constrainedBy(new RegexConstraint(expr));

      if (log.isTraceEnabled()) {
         log.trace("Parameter [{}] has been constrained by [{}]", parameterBuilder.getName(), expr);
      }
View Full Code Here

Examples of org.ocpsoft.rewrite.param.RegexConstraint

   {
      if (captureIn != null)
      {
         Parameter<?> parameter = store.get(captureIn);
         if (parameter instanceof ConfigurableParameter<?>)
            ((ConfigurableParameter<?>) parameter).constrainedBy(new RegexConstraint(".*"));
      }
      if (withRequestBinding)
      {
         for (String param : getRequiredParameterNames())
         {
View Full Code Here

Examples of org.ocpsoft.rewrite.param.RegexConstraint

   {
      if (captureIn != null)
      {
         Parameter<?> parameter = store.get(captureIn);
         if (parameter instanceof ConfigurableParameter<?>)
            ((ConfigurableParameter<?>) parameter).constrainedBy(new RegexConstraint(".*"));
      }
      if (withRequestBinding)
      {
         for (String param : getRequiredParameterNames()) {
            Parameter<?> parameter = store.get(param);
View Full Code Here

Examples of org.ocpsoft.rewrite.param.RegexConstraint

   }

   @Test
   public void testQueryStringMatchesPattern()
   {
      store.get("x", new DefaultParameter("x").constrainedBy(new RegexConstraint(".*&one=1.*")));
      Query query = Query.matches("{x}");
      query.setParameterStore(store);
      Assert.assertTrue(query.evaluate(rewrite, context));
   }
View Full Code Here

Examples of org.ocpsoft.rewrite.param.RegexConstraint

   }

   @Test
   public void testQueryStringBindsToEntireValue()
   {
      store.get("x", new DefaultParameter("x").constrainedBy(new RegexConstraint(".*&one=1.*")));
      Query query = Query.matches("{x}");
      query.setParameterStore(store);
      Assert.assertTrue(query.evaluate(rewrite, context));

      Assert.assertTrue(query.evaluate(rewrite, context));
View Full Code Here

Examples of org.ocpsoft.rewrite.param.RegexConstraint

      ParameterUtils.initialize(context, header);

      ParameterStore parameters = DefaultParameterStore.getInstance(context);
      Parameter<?> parameter = parameters.get("enc");
      if (parameter instanceof ConfigurableParameter<?>)
         ((ParameterConfiguration<?>) parameter).constrainedBy(new RegexConstraint("(ISO|UTF)-\\d+"));

      Assert.assertTrue(header.evaluate(rewrite, context));
   }
View Full Code Here

Examples of org.ocpsoft.rewrite.param.RegexConstraint

      MockEvaluationContext context = new MockEvaluationContext();
      ParameterUtils.initialize(context, url);

      ParameterStore store = DefaultParameterStore.getInstance(context);
      ((ParameterConfiguration<?>) store .get("prefix")).constrainedBy(new RegexConstraint(".*"));
      ((ParameterConfiguration<?>) store.get("suffix")).constrainedBy(new RegexConstraint("\\?.*"));

      Assert.assertTrue(url.evaluate(rewrite, context));
   }
View Full Code Here

Examples of org.ocpsoft.rewrite.param.RegexConstraint

      ParameterUtils.initialize(context, parameter);
      Assert.assertTrue(parameter.evaluate(rewrite, context));

      ParameterStore store = DefaultParameterStore.getInstance(context);
      Parameter<?> p = store.get("value");
      ((ParameterConfiguration<?>) p).constrainedBy(new RegexConstraint("(bar|baz)"));
      Assert.assertFalse(parameter.evaluate(rewrite, context));
   }
View Full Code Here

Examples of org.ocpsoft.rewrite.param.RegexConstraint

      RequestParameter parameter = RequestParameter.matchesAll("{name}", "{value}");
      MockEvaluationContext context = new MockEvaluationContext();
      ParameterUtils.initialize(context, parameter);

      ParameterStore store = DefaultParameterStore.getInstance(context);
      ((ParameterConfiguration<?>) store.get("value")).constrainedBy(new RegexConstraint("nothing"));
      Assert.assertFalse(parameter.evaluate(rewrite, context));
   }
View Full Code Here

Examples of org.ocpsoft.rewrite.param.RegexConstraint

      RequestParameter requestParam = RequestParameter.matchesAll("{name}", "{value}");
      MockEvaluationContext context = new MockEvaluationContext();
      ParameterUtils.initialize(context, requestParam);

      ParameterStore store = DefaultParameterStore.getInstance(context);
      ((ParameterConfiguration<?>) store.get("name")).constrainedBy(new RegexConstraint("nothing"));
      Assert.assertFalse(requestParam.evaluate(rewrite, new MockEvaluationContext()));
   }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.