Use PathBindable to bind parameters from a path, not from a query. An example implementation for binding identifiers from a path, separated by a comma (without error handling):
public class CommaSeparatedIds implements PathBindable<CommaSeparatedIds> { private List<Long> id; @Override public IdBinder bind(String key, String txt) { if ("id".equals(key)) { String[] split = txt.split(","); id = new ArrayList<>(split.length + 1); for (String s : split) { long parseLong = Long.parseLong(s); id.add(Long.valueOf(parseLong)); } return this; } return null; } ... }
Example path:
/data/entity/1,2,3,4
Example route input:
GET /data/entity/:id controllers.EntityController.process(id: CommaSeparatedIds)
source share