Search code examples
spring-bootcurljerseyjax-rs

Can't recognise multiple URL query parameters in spring boot, jax-rs, jersey


Having a problem passing multiple query parameters in a curl command to my spring boot server which is using jersey and jax-rs to serve up a few end points.

Here is my curl command:

curl localhost:8080/players?pageStartIndex=3&pageSize=4

I use a filter to print out whats comming in

@Provider
public class APIRequestFilter implements ContainerRequestFilter {

    @Override
    public void filter(ContainerRequestContext requestContext)
             throws IOException {
        System.out.println(">>filter(), uriPath=" + requestContext.getUriInfo().getRequestUri());
        System.out.println(">>filter(), " + requestContext.getUriInfo().getQueryParameters());
        ...

Here is what is printed out...

>>filter(), uriPath=http://localhost:8080/players?pageStartIndex=3
>>filter(), {pageStartIndex=[3]}

For some reason, only the first query parameter is printed out.

Any ideas?


Solution

  • You need to wrap the url in the command line in quotes. & has a special meaning on the command line.