@Override
public Object readFrom(Class<Object> type, Type type1, Annotation[] antns, MediaType mt, MultivaluedMap<String, String> headers, InputStream in) throws IOException, WebApplicationException {
try {
String charset = mt.getParameters().get("charset");
if (charset == null || charset.isEmpty()) {
charset = "UTF-8";
}
String data = GwtRpcUtil.streamToString(in, charset);
if (data.isEmpty()) {
throw new WebApplicationException(Response.Status.NO_CONTENT);
}
return GwtRpcUtil.deserialize(data);
} catch (SerializationException ex) {
logger.error("Failed to deserialize RPC data", ex);
throw new WebApplicationException(ex, Response.Status.BAD_REQUEST);
}
}
}