use of org.apache.cxf.jaxrs.ext.multipart.MultipartOutputFilter in project cxf by apache.
the class MultipartProvider method writeTo.
public void writeTo(Object obj, Class<?> type, Type genericType, Annotation[] anns, MediaType mt, MultivaluedMap<String, Object> headers, OutputStream os) throws IOException, WebApplicationException {
List<Attachment> handlers = convertToDataHandlers(obj, type, genericType, anns, mt);
if (mc.get(AttachmentUtils.OUT_FILTERS) != null) {
List<MultipartOutputFilter> filters = CastUtils.cast((List<?>) mc.get(AttachmentUtils.OUT_FILTERS));
for (MultipartOutputFilter filter : filters) {
filter.filter(handlers);
}
}
mc.put(MultipartBody.OUTBOUND_MESSAGE_ATTACHMENTS, handlers);
handlers.get(0).getDataHandler().writeTo(os);
}
use of org.apache.cxf.jaxrs.ext.multipart.MultipartOutputFilter in project cxf by apache.
the class AttachmentUtils method addMultipartOutFilter.
public static void addMultipartOutFilter(MultipartOutputFilter filter) {
Message m = JAXRSUtils.getCurrentMessage();
List<MultipartOutputFilter> outFilters = CastUtils.cast((List<?>) m.get(OUT_FILTERS));
if (outFilters == null) {
outFilters = new ArrayList<>();
m.put(OUT_FILTERS, outFilters);
}
outFilters.add(filter);
}
use of org.apache.cxf.jaxrs.ext.multipart.MultipartOutputFilter in project tomee by apache.
the class MultipartProvider method writeTo.
public void writeTo(Object obj, Class<?> type, Type genericType, Annotation[] anns, MediaType mt, MultivaluedMap<String, Object> headers, OutputStream os) throws IOException, WebApplicationException {
List<Attachment> handlers = convertToDataHandlers(obj, type, genericType, anns, mt);
if (mc.get(AttachmentUtils.OUT_FILTERS) != null) {
List<MultipartOutputFilter> filters = CastUtils.cast((List<?>) mc.get(AttachmentUtils.OUT_FILTERS));
for (MultipartOutputFilter filter : filters) {
filter.filter(handlers);
}
}
mc.put(MultipartBody.OUTBOUND_MESSAGE_ATTACHMENTS, handlers);
handlers.get(0).getDataHandler().writeTo(os);
}
Aggregations