MediaType mediaType,
MultivaluedMap<String, String> httpHeaders,
InputStream entityStream) throws IOException, WebApplicationException {
MessageBodyReader<AtomEntry> reader =
providers.getMessageBodyReader(AtomEntry.class, genericType, annotations, mediaType);
AtomEntry entry =
reader.readFrom(AtomEntry.class,
genericType,
annotations,
mediaType,
httpHeaders,
entityStream);
/*
* The value in the AtomContent object is arbitrary, set by the server. We want to use the
* built-in AND client application supplied providers. Because these providers are collected
* on the thread local store, and the unmarshalling of the AtomContent value is done lazily
* (after the client-server context has expired), we need some way to hold onto the Providers
* long enough for the client app to be able to seamlessly get the value off the AtomContent
* object. Thus the need to set the *real* providers list on the AtomContent object, so it
* can use the list to pass to ModelUtils when it needs to retrieve and unmarshal the AtomContent
* value.
*
* We have to be careful to use the real Providers list instead of the one from the injected
* local providers field in this class. The injected object may be a "proxy" to the real
* providers, and could cause an infinite loop when ModelUtils.readValue calls back through
* the providers.
*/
SyndEntry returnVal = entry.toSynd(new SyndEntry());
SyndContent content = returnVal.getContent();
if (content != null) {
content.setProviders(RuntimeContextTLS.getRuntimeContext().getAttribute(Providers.class));
}