My Application currently serves requests for data, and can order the data to the users requirements, using RequestParams
@RequestParam(value = "orderBy", required = false, defaultValue = "severity") String orderBy,
@RequestParam(value = "order", required = false, defaultValue = "desc") String order,
You get the idea.
However, I want to implement multi sorting, (ordering by severity, then matching severities are ordered by date). Code wise, this is easy (google-collections to the rescue), but how would I expose this to the user calling the service?
Ideally, I wouldn't want multiple orderBy @RequestParams (orderBy2, orderBy3, orderBy4) , as that's just plain ugly.
Thoughts?
Cheers
Usually you should be able to just turn your request param into an array like:
@RequestParam(value = "orderBy", required = false, defaultValue = "severity") String[] orderBy,
@RequestParam(value = "order", required = false, defaultValue = "desc") String[] order,
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With