I am using REST-Jersey in my project. All the POST data is send in JSON format and unmarshalled at server-side into respective beans. Something lik
Do not use in.available() method to check the total bytes of Inputstream. Some clients does not set this value. And in this case it will be foul eventhough the message body input stream exists.
InputStream in = request.getEntityInputStream();
final StringBuilder b = new StringBuilder();
try {
if (in.available() > 0)
Use below code
String json = IOUtils.toString(requestContext.getEntityStream(), Charsets.UTF_8);
messageBody = json;
InputStream in = IOUtils.toInputStream(json);
requestContext.setEntityStream(in);