This discussion is archived
0 Replies Latest reply: Jul 26, 2013 7:16 AM by 801188 RSS

Query about JSON Service Method Signature

801188 Newbie
Currently Being Moderated

Hi All,

I want to develop a RESTful Service, and I am planning to use jackson for Object Conversion(JacksonJsonProvider+Apache wink).If I am using JacksonJsonProvider and the request is not in correct format it will be difficult to debug. If  service is accepting json String as parameter  and using ObjectMapper to convert this back to Object ,we will get the exact JSON String from Consumer . Is this the right approach or Offload this to Providers?
1)

@Path(value = "/testSrv.json")

@Produces({MediaType.APPLICATION_JSON})

@Consumes({MediaType.APPLICATION_JSON})

public Response testSrv(final Test test) throws MyException 

2)
@POST
@Path(value = "/testSrv.json")
@Produces({MediaType.APPLICATION_JSON})
@Consumes({MediaType.APPLICATION_JSON})
public Response testSrv(final String stringJSON) throws MyException

What is the correct method Signature ?1 or 2.
Thanks

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points