config-servlet/src/main/java/org/ocpsoft/rewrite/servlet/config/Query.java
public static Query valueExists(final String valuePattern)
   {
      Assert.notNull(valuePattern, "Parameter value pattern must not be null.");

      return new Query() {
         final ParameterizedPatternParser pattern = new RegexParameterizedPatternParser(valuePattern);

         @Override
         public boolean evaluateHttp(final HttpServletRewrite event, final EvaluationContext context)
         {
            QueryStringBuilder queryString = QueryStringBuilder.createFromEncoded(event.getAddress().getQuery())
                     .decode();

            for (String name : queryString.getParameterNames()) {

               for (String value : queryString.getParameterValues(name)) {
                  if (value != null && pattern.parse(value).submit(event, context))
                  {
                     return true;
                  }
               }
            }

            return false;
         }

         @Override
         public String toString()
         {
            return "Query.valueExists(\"" + valuePattern + "\")";
         }

         @Override
         public Set<String> getRequiredParameterNames()
         {
            return pattern.getRequiredParameterNames();
         }

         @Override
         public void setParameterStore(ParameterStore store)
         {
            pattern.setParameterStore(store);
         }
      };
   }
public static Query valueExists(final String valuePattern)
   {
      Assert.notNull(valuePattern, "Parameter value pattern must not be null.");

      return new Query() {
         final ParameterizedPatternParser pattern = new RegexParameterizedPatternParser(valuePattern);

         @Override
         public boolean evaluateHttp(final HttpServletRewrite event, final EvaluationContext context)
         {
            QueryStringBuilder queryString = QueryStringBuilder.createFromEncoded(event.getAddress().getQuery())
                     .decode();

            for (String name : queryString.getParameterNames()) {

               for (String value : queryString.getParameterValues(name)) {
                  if (value != null && pattern.parse(value).submit(event, context))
                  {
                     return true;
                  }
               }
            }

            return false;
         }

         @Override
         public String toString()
         {
            return "Query.valueExists(\"" + valuePattern + "\")";
         }

         @Override
         public Set<String> getRequiredParameterNames()
         {
            return pattern.getRequiredParameterNames();
         }

         @Override
         public void setParameterStore(ParameterStore store)
         {
            pattern.setParameterStore(store);
         }
      };
   }
public static Query valueExists ( final String valuePattern ) { Assert . notNull ( valuePattern , "Parameter value pattern must not be null." ) ; return new Query ( ) { final ParameterizedPatternParser pattern = new RegexParameterizedPatternParser ( valuePattern ) ; @ Override public boolean evaluateHttp ( final HttpServletRewrite event , final EvaluationContext context ) { QueryStringBuilder queryString = QueryStringBuilder . createFromEncoded ( event . getAddress ( ) . getQuery ( ) ) . decode ( ) ; for ( String name : queryString . getParameterNames ( ) ) { for ( String value : queryString . getParameterValues ( name ) ) { if ( value != null && pattern . parse ( value ) . submit ( event , context ) ) { return true ; } } } return false ; } @ Override public String toString ( ) { return "Query.valueExists(\"" + valuePattern + "\")" ; } @ Override public Set < String > getRequiredParameterNames ( ) { return pattern . getRequiredParameterNames ( ) ; } @ Override public void setParameterStore ( ParameterStore store ) { pattern . setParameterStore ( store ) ; } } ; }
Create a {@link Condition} asserting the existence of specific parameter values within the current
{@link Address#getQuery()}.

@param pattern {@link ParameterizedPattern} matching query parameter values of the current
{@link Address#getQuery()}.

@see ConfigurationRuleParameterBuilder#where(String)
Create a { @link Condition } asserting the existence of specific parameter values within the current { @link Address#getQuery () } .