I'm working with a large existing project, which utilises javax.ws.rs.client.WebTarget to talk to RESTful API. The API is developed by a third party and I have no control over it. I need to make a request in the following format:
https://end.point.url/endpoint/id?data
Unfortunately, I can't figure out how to specify such request using WebTarget. I tried using path("endpoint/id?data"), but this gets converted into endpoint/id%3Fdata and I get 404 back. I tried using queryParam specifying empty value, which gets me endpoint/id?data= - which results in error required parameter data missing.
What other option is there? Replacing WebTarget with something else isn't feasible, as it is all over the large project.
First, related question: Url encoding issue with Jersey Client
After quite a bit of research, it seems that the only way to do it is to specify the entire uri when the WebTarget is created, like so: