I'm trying to bind values in a GET request to a POJO.
The values are parameters in a HTTP GET request. I'm using JSONP to pass the parameters however it looks like JSONP pushes the JSON object up onto the Request line so its not really a JSON object which is being sent but instead just name value pairs on the URL.
Is it possible to map the values in my GET request to a POJO? Jersey gives the following exception when i try binding
A HTTP GET method, public void handleJSONP(MyPojo), should not consume any entity.
The binding code is looking in the request body however it doesnt exist because it is a GET request. Is there any other way to bind the values in the request without having to manually include a @QueryParam entry for each ?
Thanks
I was able resolve this by using @com.sun.jersey.api.core.InjectParam of jersey
public JSONWithPadding doSomething(@InjectParam final MyPojo argPojo)
Then the Pojo looks like this
public class MyPojo
{
/** */
@QueryParam("value1")
private String value1;
/** */
@QueryParam("value2")
private String value2;
/** */
@QueryParam("value3")
private List<String> value3;
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