how to store JSON into POJO using Jackson
Posted
by
user2963680
on Stack Overflow
See other posts from Stack Overflow
or by user2963680
Published on 2013-11-07T09:51:03Z
Indexed on
2013/11/07
9:53 UTC
Read the original article
Hit count: 426
I am developing a module where i am using rest service to get data. i am not getting how to store JSON using Jackson and store it which has Queryparam also. Any help is really appreciated as I am new to this.I am trying to do server side filtering in extjs infinte grid which is sending the below request to rest service. when the page load first time, it sends
http://myhost/mycontext/rest/populateGrid?_dc=9999999999999&page=1&start=0&limit=500
when you select filter on name and place, it sends
http://myhost/mycontext/rest/populateGrid?_dc=9999999999999&filter=[{"type":"string","value":"Tom","field":"name"},{"type":"string","value":"London","field":"Location"}]&page=1&start=0&limit=500
I am trying to save this in POJO and then sending this to database to retrieve data. For this on rest side i have written something like this
@Provider
@Path("/rest")
public interface restAccessPoint {
@GET
@Path("/populateGrid")
@Produces({MediaType.APPLICATION_JSON})
public Response getallGridData(FilterJsonToJava filterparam,@QueryParam("page") String page,@QueryParam("start") String start,@QueryParam("limit") String limit);
}
public class FilterJsonToJava {
@JsonProperty(value ="filter")
private List<Filter> data;
.. getter and setter below
}
public class Filter {
@JsonProperty("type")
private String type;
@JsonProperty("value")
private String value;
@JsonProperty("field")
private String field;
...getter and setters below
}
I am getting the below error
The following warnings have been detected with resource and/or provider classes: WARNING: A HTTP GET method, public abstract javax.ws.rs.core.Response com.xx.xx.xx.xxxxx (com.xx.xx.xx.xx.json.FilterJsonToJava ,java.lang.String,java.lang.String,java.lang.String), should not consume any entity.
com.xx.xx.xx.xx.json.FilterJsonToJava, and Java type class com.xx.xx.xx.FilterJsonToJava, and MIME media type application/octet-stream was not found
[11/6/13 17:46:54:065] 0000001c ContainerRequ E The registered message body readers compatible with the MIME media type are:
application/octet-stream
com.sun.jersey.core.impl.provider.entity.ByteArrayProvider com.sun.jersey.core.impl.provider.entity.FileProvider com.sun.jersey.core.impl.provider.entity.InputStreamProvider com.sun.jersey.core.impl.provider.entity.DataSourceProvider com.sun.jersey.core.impl.provider.entity.RenderedImageProvider */* -> com.sun.jersey.core.impl.provider.entity.FormProvider ...
© Stack Overflow or respective owner