1

Currently I'm working with Dropwizard and want to trim whitespaces from query parameters that are passed in, that match a specific key (in my case, query). I couldn't find documentation on how to do this.

The closest solution I've found, apart from manually trimming the whitespace, is to create a new annotation, however I'm trying to avoid changing dozens of endpoints, and would rather override the base annotation to apply the change.

Colby
  • 313
  • 4
  • 13

1 Answers1

1

You could write a jetty servlet filter to modify that query param, see this thread for an example: https://stackoverflow.com/a/1422202/52954

Then register that filter:

environment.servlets().addFilter("Custom-Filter-Name", new MyCustomFilter());
LiorH
  • 18,524
  • 17
  • 70
  • 98