Skip to content
Advertisement

Java Jersery: How to handle multiple Queries Parameters for a REST URL with UriInfo

I have implemented a rest Query as shown below:

JavaScript

How do I handle when multiple parameters

JavaScript

Here instead of two strings, I am getting it as one single string. How should I handle it, should I split the parameter String by comma (,).?

When

Currently it is able to handle these endpoints. The Rest URL’s are

JavaScript

Advertisement

Answer

If you want queryParameters.get(assignee.name); to return a list, you can include the parameter more than once in the URL

http://localhost:9090/hello-todo/api/v1/todo/list?assignee.name=name1&assignee.name=name2

Or you can continue to have a single parameter (list?assignee.name=name1,name2) and split on ,, but you have to write the code to do that, and consider what to do when one of your names has a , character in it.

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement