Suppose we have some RESTful resource serving this POST:
@POST
@Produces("application/json")
@Consumes("application/json")
public String doPostJson(String string) {
...
}
( I was able to run the above in my server so I am assuming this is a valid implementation )
Now I am thinking the doPostJson() gets String and returns String. This string could be something totally different than JSON valid string. Am I right? So what is the meaning of "application/json" if I can use any string here?
MORE: In other hand, could I just use this?
@POST
@Produces("text/plain")
@Consumes("text/plain")
public String doPostJson(String string) {
... /* read passed parameter as JSON valid string and return JSON string */
}