Right now, we're doing a lot of this in our MessageBodyWriter(s):
@Override
public long getSize(PropValue value, Class<?> type, Type type1,
Annotation[] annotations, MediaType mediaType) {
//TODO: Do this
return -1L;
}
The problem is that we're doing some objects->byte conversions in the
MessageBodyWriter.writeTo method. The docs for MessageBodyWriter say
getSize is called before writeTo, so to respond properly to getSize,
we have to do the objects->byte conversions twice, once to get the
size and another time to actually write it out.
What is the Jersey lifecycle of MessageBodyWriters? Is it safe to do
the converting in the getSize method, then save the result for use in
the writeTo method?
Thanks,
Gary
--
Gary Moore
http://athena.fracturedatlas.org
http://www.gmoore.net