Hi All,
I'm trying to see if i can directly consume a json query parameter of a GET
request to a custom type object. Can this deserialization (ie. json to java
custom object) occur automatically? I'm not able to get it working, provided
below the use case, code snippet that I was expecting to work and the error
that I get when I deploy. Appreciate your help/suggestions on this!!
*Use Case:*
my client(browser based) sends a search query as json (which will have
page#, page size, filter/sort criteria etc) and on the Rest side, i will
have to map it to SearchQuery object which I would use to return to matching
objects(as json) back to the client. Following is the code that i have
written for the same. But when I deploy it, i get an error which I have also
mentioned below.
*Code Snippet:
*
@GET
@Consumes("application/json")
@Produces("application/json")
@Path("/Users")
public MinimalUserDTO[] getUserByCriteria(@QueryParam("searchQuery")
SearchQuery searchQuery)
{
//get User Data based on searchQuery
//return array of user
}
*Error:
*
Method, public java.lang.String getUserByCriteria(MinimalUserDTO[]),
annotated with GET of resource, class UserRestService, is not recognized as
valid Java method annotated with @HttpMethod.
Thanks,
Shankar