@Override public T readFrom(Class<T> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, String> headers, InputStream is) throws IOException, WebApplicationException { if (!supportSimpleTypesOnly && !InjectionUtils.isPrimitive(type)) { MessageBodyReader<T> next = providers.getMessageBodyReader(type, genericType, annotations, mediaType); JAXRSUtils.getCurrentMessage().put(ProviderFactory.ACTIVE_JAXRS_PROVIDER_KEY, this); try { return next.readFrom(type, genericType, annotations, mediaType, headers, is); } finally { JAXRSUtils.getCurrentMessage().put(ProviderFactory.ACTIVE_JAXRS_PROVIDER_KEY, null); } } String data = IOUtils.toString(is).trim(); int index = data.indexOf(':'); data = data.substring(index + 1, data.length() - 1).trim(); if (data.startsWith("\"")) { data = data.substring(1, data.length() - 1); } return primitiveHelper.readFrom(type, genericType, annotations, mediaType, headers, new ByteArrayInputStream(StringUtils.toBytesUTF8(data))); }
@Override public T readFrom(Class<T> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, String> headers, InputStream is) throws IOException, WebApplicationException { if (!supportSimpleTypesOnly && !InjectionUtils.isPrimitive(type)) { MessageBodyReader<T> next = providers.getMessageBodyReader(type, genericType, annotations, mediaType); JAXRSUtils.getCurrentMessage().put(ProviderFactory.ACTIVE_JAXRS_PROVIDER_KEY, this); try { return next.readFrom(type, genericType, annotations, mediaType, headers, is); } finally { JAXRSUtils.getCurrentMessage().put(ProviderFactory.ACTIVE_JAXRS_PROVIDER_KEY, null); } } String data = IOUtils.toString(is).trim(); int index = data.indexOf(':'); data = data.substring(index + 1, data.length() - 1).trim(); if (data.startsWith("\"")) { data = data.substring(1, data.length() - 1); } return primitiveHelper.readFrom(type, genericType, annotations, mediaType, headers, new ByteArrayInputStream(StringUtils.toBytesUTF8(data))); }