Reply To: add Rule realy dynamic

Splash Forums Rewrite Users add Rule realy dynamic Reply To: add Rule realy dynamic

#25226

It sounds like you are trying to add one rule for each item in a database, resulting in a potentially massive rule-set, perhaps you could write a single rule that would work for all database items? something like this:

@Override
public Configuration getConfiguration( ServletContext context ) {

  ConfigurationBuilder builder = ConfigurationBuilder.begin();

     .addRule(Join.path("/item/{id}").to("/viewItem.jsp"))
     .where(new HttpCondition() {
         public boolean evaluateHttp(HttpServletRewrite event, EvaluationContext context)
         {
            String id = context.get(ParameterValueStore.class)
                               .get(context.get(ParameterStore.class)
                               .get("id"));

            // Perform database lookup of ID.
         }
     })
  
  return builder;
}

Does this help?