* Method that JAX-RS container calls to deserialize given value.
*/
public Object readFrom(Class<Object> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String,String> httpHeaders, InputStream entityStream)
throws IOException
{
AnnotationBundleKey key = new AnnotationBundleKey(annotations);
EndpointConfig endpoint;
synchronized (_readers) {
endpoint = _readers.get(key);
}
// not yet resolved (or not cached any more)? Resolve!
if (endpoint == null) {
XmlMapper mapper = locateMapper(type, mediaType);
endpoint = EndpointConfig.forReading(mapper, annotations);
// and cache for future reuse
synchronized (_readers) {
_readers.put(key.immutableKey(), endpoint);
}
}
ObjectReader reader = endpoint.getReader();
// Fix for [Issue#4]: note, can not try to advance parser, XML parser complains
PushbackInputStream wrappedStream = new PushbackInputStream(entityStream);