public void writeTo(Object value, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType,
MultivaluedMap<String,Object> httpHeaders, OutputStream entityStream)
throws IOException
{
AnnotationBundleKey key = new AnnotationBundleKey(annotations);
EndpointConfig endpoint;
synchronized (_writers) {
endpoint = _writers.get(key);
}
// not yet resolved (or not cached any more)? Resolve!
if (endpoint == null) {
XmlMapper mapper = locateMapper(type, mediaType);
endpoint = EndpointConfig.forWriting(mapper, annotations);
// and cache for future reuse
synchronized (_writers) {
_writers.put(key.immutableKey(), endpoint);
}
}
ObjectWriter writer = endpoint.getWriter();
/* 27-Feb-2009, tatu: Where can we find desired encoding? Within
* HTTP headers?
*/
JsonEncoding enc = findEncoding(mediaType, httpHeaders);