Reply To: Is it possible to add/remove query parameters?

Splash Forums Rewrite Users Is it possible to add/remove query parameters? Reply To: Is it possible to add/remove query parameters?

#26276

Hey there. Yes, it is certainly possible to remove parameters from links. This should probably be done in an outbound rewrite rule, but I don’t think there’s a shorthand way of doing it. You’ll have to do it in plain old Java, something like this:

.addRule()
.when(Direction.isOutbound().and(QueryParameter.exists("other")))
.perform(new HttpOperation() {
   public void perform(HttpServletRewrite event, EvalutationContext context)
   {
       Address address = event.getAddress();
       String newAddress = address.toString();
       newAddress = // Remove parameters from newAddress.
       event.setAddress(AddressBuilder.create(newAddress))
   }
})

Something like that. There are some Deprecated URLBuilder and QueryString builder types that may help you do this, but we will probably be replacing them with a betting API in the AddressBuilder API at some point in the future. This will work for now.