Message message)
throws WebApplicationException, IOException {
OutputStream entityStream = message.getContent(OutputStream.class);
if (writers.size() > 1) {
WriterInterceptor first = writers.remove(0);
WriterInterceptorContext context = new WriterInterceptorContextImpl(entity,
type,
genericType,
annotations,
mediaType,
entityStream,
message,
writers);
first.aroundWriteTo(context);
} else {
MessageBodyWriter<Object> writer = ((WriterInterceptorMBW)writers.get(0)).getMBW();
writer.writeTo(entity, type, genericType, annotations, mediaType,
httpHeaders, entityStream);
}