Refine search
@Override protected Attachment createAttachment(Object object, String id) { DataSource source = (DataSource)object; DataHandler handler = new DataHandler(source); AttachmentImpl att = new AttachmentImpl(id, handler); att.setXOP(true); return att; }
dh = new DataHandler(createDataSource((Source)o, ct)); } else if (o instanceof Image) { final Image img = (Image)o; final String contentType = ct; dh = new DataHandler(o, ct) { @Override public InputStream getInputStream() throws IOException { ct = dh.getContentType(); AttachmentImpl att = new AttachmentImpl(id); att.setDataHandler(dh); att.setHeader("Content-Type", ct); att.setHeader("Content-ID", "<" + id + ">"); atts.add(att);
@Override protected Attachment createAttachment(Object object, String id) { DataHandler handler = (DataHandler)object; AttachmentImpl att = new AttachmentImpl(id, handler); att.setXOP(true); return att; }
attachments = new HashSet<>(); AttachmentImpl attachment = new AttachmentImpl(entry.getKey()); org.apache.camel.Attachment camelAttachment = entry.getValue(); attachment.setDataHandler(camelAttachment.getDataHandler()); for (String name : camelAttachment.getHeaderNames()) { attachment.setHeader(name, camelAttachment.getHeader(name)); attachment.setXOP(isXop); attachments.add(attachment);
new org.apache.cxf.attachment.AttachmentImpl( attachmentResultCallback.getAttachmentId(), new DataHandler( new AttachmentDataSource( attachmentResultCallback.getAttachment().getMimeType(), securedAttachment.setHeader(entry.getKey(), entry.getValue());
public static Attachment getAttachment(String id, Collection<Attachment> attachments) { if (id == null) { throw new DatabindingException("Cannot get attachment: null id"); } int i = id.indexOf("cid:"); if (i != -1) { id = id.substring(4).trim(); } if (attachments == null) { return null; } for (Iterator<Attachment> iter = attachments.iterator(); iter.hasNext();) { Attachment a = iter.next(); if (a.getId().equals(id)) { return a; } } // Try loading the URL remotely try { URLDataSource source = new URLDataSource(new URL(id)); return new AttachmentImpl(id, new DataHandler(source)); } catch (MalformedURLException e) { return null; } } }
DataSource ds = handler.getDataSource(); if (ds instanceof FileDataSource) { FileDataSource fds = (FileDataSource)ds; Object o = handler.getContent(); if (o instanceof String && ((String)o).length() < threshold) { throw new Fault(e); AttachmentImpl att = new AttachmentImpl(id, handler); if (!StringUtils.isEmpty(handler.getName())) { String file = handler.getName(); file = f.getName(); att.setHeader("Content-Disposition", "attachment;name=\"" + file + "\""); att.setXOP(isXop); return att;
public Attachment next() { Map.Entry<String, DataHandler> e = iterator.next(); key = e.getKey(); Attachment o = cache.get(key); if (o == null) { o = new AttachmentImpl(key, e.getValue()); cache.put(key, o); } return o; }
AttachmentImpl att = new AttachmentImpl(handler.getContentId(), handler.getDataHandler()); for (String key : handler.getHeaders().keySet()) { att.setHeader(key, handler.getHeader(key)); att.setXOP(false); atts.add(att);
AttachmentPart part = it.next(); String id = AttachmentUtil.cleanContentId(part.getContentId()); AttachmentImpl att = new AttachmentImpl(id); try { att.setDataHandler(part.getDataHandler()); } catch (SOAPException e) { throw new Fault(e); while (it2.hasNext()) { MimeHeader header = it2.next(); att.setHeader(header.getName(), header.getValue());
AttachmentImpl att = new AttachmentImpl(id); encoding = getHeader(headers, name); if ("binary".equalsIgnoreCase(encoding)) { att.setXOP(true); att.setHeader(name, getHeaderValue(e.getValue())); ((AttachmentDataSource)source).setName(fileName); att.setDataHandler(new DataHandler(source)); return att;
new org.apache.cxf.attachment.AttachmentImpl( attachmentResultCallback.getAttachmentId(), new DataHandler( new AttachmentDataSource( attachmentResultCallback.getAttachment().getMimeType(), securedAttachment.setHeader(entry.getKey(), entry.getValue());
public static Attachment getAttachment(String id, Collection<Attachment> attachments) { if (id == null) { throw new DatabindingException("Cannot get attachment: null id"); } int i = id.indexOf("cid:"); if (i != -1) { id = id.substring(4).trim(); } if (attachments == null) { return null; } for (Iterator<Attachment> iter = attachments.iterator(); iter.hasNext();) { Attachment a = iter.next(); if (a.getId().equals(id)) { return a; } } // Try loading the URL remotely try { URLDataSource source = new URLDataSource(new URL(id)); return new AttachmentImpl(id, new DataHandler(source)); } catch (MalformedURLException e) { return null; } } }
DataSource ds = handler.getDataSource(); if (ds instanceof FileDataSource) { FileDataSource fds = (FileDataSource)ds; Object o = handler.getContent(); if (o instanceof String && ((String)o).length() < threshold) { throw new Fault(e); AttachmentImpl att = new AttachmentImpl(id, handler); if (!StringUtils.isEmpty(handler.getName())) { String file = handler.getName(); file = f.getName(); att.setHeader("Content-Disposition", "attachment;name=\"" + file + "\""); att.setXOP(isXop); return att;
@SuppressWarnings("unchecked") public <T> T[] toArray(T[] a) { T[] copy = a.length == attachments.size() ? a : (T[])Array.newInstance(a.getClass().getComponentType(), attachments.size()); int i = 0; for (Map.Entry<String, DataHandler> entry : attachments.entrySet()) { Attachment o = cache.get(entry.getKey()); if (o == null) { o = new AttachmentImpl(entry.getKey(), entry.getValue()); cache.put(entry.getKey(), o); } copy[i++] = (T)o; } return copy; }
@Override protected Attachment createAttachment(Object object, String id) { DataHandler handler = (DataHandler)object; AttachmentImpl att = new AttachmentImpl(id, handler); att.setXOP(true); return att; }
AttachmentImpl att = new AttachmentImpl(handler.getContentId(), handler.getDataHandler()); for (String key : handler.getHeaders().keySet()) { att.setHeader(key, handler.getHeader(key)); att.setXOP(false); atts.add(att);
AttachmentPart part = it.next(); String id = AttachmentUtil.cleanContentId(part.getContentId()); AttachmentImpl att = new AttachmentImpl(id); try { att.setDataHandler(part.getDataHandler()); } catch (SOAPException e) { throw new Fault(e); while (it2.hasNext()) { MimeHeader header = it2.next(); att.setHeader(header.getName(), header.getValue());
@Override protected Attachment createAttachment(Object object, String id) { DataSource source = (DataSource)object; DataHandler handler = new DataHandler(source); AttachmentImpl att = new AttachmentImpl(id, handler); att.setXOP(true); return att; }
AttachmentImpl att = new AttachmentImpl(id); encoding = getHeader(headers, name); if ("binary".equalsIgnoreCase(encoding)) { att.setXOP(true); att.setHeader(name, getHeaderValue(e.getValue())); ((AttachmentDataSource)source).setName(fileName); att.setDataHandler(new DataHandler(source)); return att;