@SuppressWarnings("unchecked") private<T> void writePayloadTo(Class<T> cls, Type type, Annotation[] anns, MediaType mt, MultivaluedMap<String, Object> headers, Object data, OutputStream os) throws IOException, WebApplicationException { MessageBodyWriter<T> writer = null; if (message != null && factory != null) { writer = factory.createMessageBodyWriter(cls, type, anns, mt, message); } if (writer == null) { throw new InternalServerErrorException("No suitable message body writer for class: " + cls.getName()); } writer.writeTo((T)data, cls, type, anns, mt, headers, os); }
@SuppressWarnings("unchecked") private<T> void writePayloadTo(Class<T> cls, Type type, Annotation[] anns, MediaType mt, MultivaluedMap<String, Object> headers, Object data, OutputStream os) throws IOException, WebApplicationException { MessageBodyWriter<T> writer = null; if (message != null && factory != null) { writer = factory.createMessageBodyWriter(cls, type, anns, mt, message); } if (writer == null) { throw new InternalServerErrorException("No suitable message body writer for class: " + cls.getName()); } writer.writeTo((T)data, cls, type, anns, mt, headers, os); }