List<MediaType> consumeTypes,
Message m) {
List<MediaType> types = JAXRSUtils.intersectMimeTypes(consumeTypes, contentType);
MessageBodyReader provider = null;
for (MediaType type : types) {
provider = ProviderFactory.getInstance(m)
.createMessageBodyReader(targetTypeClass,
parameterType,
parameterAnnotations,
type,
m);
if (provider != null) {
try {
HttpHeaders headers = new HttpHeadersImpl(m);
return provider.readFrom(
targetTypeClass, parameterType, parameterAnnotations, contentType,
headers.getRequestHeaders(), is);
} catch (IOException e) {
String errorMessage = "Error deserializing input stream into target class "
+ targetTypeClass.getSimpleName()