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

      return new Query() {
         private ParameterStore store;
         final ParameterizedPatternParser pattern = new RegexParameterizedPatternParser(query);

         @Override
         public boolean evaluateHttp(final HttpServletRewrite event, final EvaluationContext context)
         {
            String queryString = null;
            if (event instanceof InboundRewrite)
            {
               queryString = event.getInboundAddress().getQuery();
            }
            else if (event instanceof HttpOutboundServletRewrite)
            {
               queryString = ((HttpOutboundServletRewrite) event).getOutboundAddress().getQuery();
            }

            if (pattern.parse(queryString == null ? "" : queryString).submit(event, context))
            {
               ParameterValueStore values = (ParameterValueStore) context.get(ParameterValueStore.class);
               for (Entry<Parameter<?>, String> entry : pattern.parse(query).getParameters(context).entrySet()) {
                  values.submit(event, context, store.get(entry.getKey().getName()), entry.getValue());
               }
               return true;
            }
            return false;
         }

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

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

         @Override
         public void setParameterStore(ParameterStore store)
         {
            pattern.setParameterStore(store);
            this.store = store;
         }
      };
   }
public static Query matches(final String query)
   {
      Assert.notNull(query, "URL pattern must not be null.");

      return new Query() {
         private ParameterStore store;
         final ParameterizedPatternParser pattern = new RegexParameterizedPatternParser(query);

         @Override
         public boolean evaluateHttp(final HttpServletRewrite event, final EvaluationContext context)
         {
            String queryString = null;
            if (event instanceof InboundRewrite)
            {
               queryString = event.getInboundAddress().getQuery();
            }
            else if (event instanceof HttpOutboundServletRewrite)
            {
               queryString = ((HttpOutboundServletRewrite) event).getOutboundAddress().getQuery();
            }

            if (pattern.parse(queryString == null ? "" : queryString).submit(event, context))
            {
               ParameterValueStore values = (ParameterValueStore) context.get(ParameterValueStore.class);
               for (Entry<Parameter<?>, String> entry : pattern.parse(query).getParameters(context).entrySet()) {
                  values.submit(event, context, store.get(entry.getKey().getName()), entry.getValue());
               }
               return true;
            }
            return false;
         }

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

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

         @Override
         public void setParameterStore(ParameterStore store)
         {
            pattern.setParameterStore(store);
            this.store = store;
         }
      };
   }
public static Query matches ( final String query ) { Assert . notNull ( query , "URL pattern must not be null." ) ; return new Query ( ) { private ParameterStore store ; final ParameterizedPatternParser pattern = new RegexParameterizedPatternParser ( query ) ; @ Override public boolean evaluateHttp ( final HttpServletRewrite event , final EvaluationContext context ) { String queryString = null ; if ( event instanceof InboundRewrite ) { queryString = event . getInboundAddress ( ) . getQuery ( ) ; } else if ( event instanceof HttpOutboundServletRewrite ) { queryString = ( ( HttpOutboundServletRewrite ) event ) . getOutboundAddress ( ) . getQuery ( ) ; } if ( pattern . parse ( queryString == null ? "" : queryString ) . submit ( event , context ) ) { ParameterValueStore values = ( ParameterValueStore ) context . get ( ParameterValueStore . class ) ; for ( Entry < Parameter < ? > , String > entry : pattern . parse ( query ) . getParameters ( context ) . entrySet ( ) ) { values . submit ( event , context , store . get ( entry . getKey ( ) . getName ( ) ) , entry . getValue ( ) ) ; } return true ; } return false ; } @ Override public String toString ( ) { return "Query.matches(\"" + query + "\")" ; } @ Override public Set < String > getRequiredParameterNames ( ) { return pattern . getRequiredParameterNames ( ) ; } @ Override public void setParameterStore ( ParameterStore store ) { pattern . setParameterStore ( store ) ; this . store = store ; } } ; }
Create a {@link Condition} matching the current {@link Address#getQuery()}.
<p>
The given pattern may be parameterized:
<p>
<code>
?param=value <br>
?param={param} <br>
?param={param}&foo=bar <br>
...
</code>
<p>

@param pattern {@link ParameterizedPattern} matching the query string of the current {@link Address}.

@see ConfigurationRuleParameterBuilder#where(String)
Create a { @link Condition } matching the current { @link Address#getQuery () } . <p > The given pattern may be parameterized : <p > <code > ?param = value <br > ?param = { param } <br > ?param = { param } &foo = bar <br > ... < / code > <p >