Keywords: Java, Jersey, JAX-RS, Query Parameters, REST, Microservices, %3F, Question Mark
In this post I'll show you first how NOT to pass query parameters to a REST Endpoint in Jersey, then the correct way.
We're going to pass a Solr search string with a query parameter "q" in the usual format of http://end/point?q=query. We'll start with our url path constant.
And then populate it with MessageFormat and pass it to our Jersey Request Builder.
The sorry result from our Posts Microservice is a 404. (Keyword: %3F)
We'll repeat the process, this time the correct way. First with an updated path constant containing no query parameter info.
We pass the base path directly to our Jersey Client Builder.
...where we add the Query Parameter in our Jersey Request.
With a much happier result.