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; }
@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; }
AttachmentImpl att = new AttachmentImpl(id); att.setDataHandler(dh); att.setHeader("Content-Type", ct);
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; }
public DataHandler put(String key, DataHandler value) { Attachment at = new AttachmentImpl(key, value); collection.add(at); return value; }
public DataHandler put(String key, DataHandler value) { Attachment at = new AttachmentImpl(key, value); collection.add(at); return value; }
@Override public String addSwaRefAttachment(DataHandler handler) { String id = UUID.randomUUID() + "@apache.org"; AttachmentImpl att = new AttachmentImpl(id, handler); att.setXOP(false); atts.add(att); return id; }
@Override public String addSwaRefAttachment(DataHandler handler) { String id = UUID.randomUUID() + "@apache.org"; AttachmentImpl att = new AttachmentImpl(id, handler); att.setXOP(false); atts.add(att); return id; }
@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; }
@Override public String addSwaRefAttachment(DataHandler handler) { String id = UUID.randomUUID() + "@apache.org"; AttachmentImpl att = new AttachmentImpl(id, handler); att.setXOP(false); atts.add(att); return id; }
@Override protected Attachment createAttachment(Object object, String id) { DataHandler handler = (DataHandler)object; AttachmentImpl att = new AttachmentImpl(id, handler); att.setXOP(true); return att; }
@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; }
public DataHandler put(String key, DataHandler value) { Attachment at = new AttachmentImpl(key, value); collection.add(at); return value; }
@Override protected Attachment createAttachment(Object object, String id) { DataHandler handler = (DataHandler)object; AttachmentImpl att = new AttachmentImpl(id, handler); att.setXOP(true); return att; }
public DataHandler put(String key, DataHandler value) { Attachment at = new AttachmentImpl(key, value); collection.add(at); return value; }
public DataHandler put(String key, DataHandler value) { Iterator<Attachment> i = list.iterator(); DataHandler ret = null; while (i.hasNext()) { Attachment a = i.next(); if (a.getId().equals(key)) { i.remove(); ret = a.getDataHandler(); break; } } list.add(new AttachmentImpl(key, value)); return ret; } }
public DataHandler put(String key, DataHandler value) { Iterator<Attachment> i = list.iterator(); DataHandler ret = null; while (i.hasNext()) { Attachment a = i.next(); if (a.getId().equals(key)) { i.remove(); ret = a.getDataHandler(); break; } } list.add(new AttachmentImpl(key, value)); return ret; } }
private Map<String, Attachment> transformToCxfAttachments(Map<String, SoapAttachment> attachments) { ImmutableMap.Builder<String, Attachment> builder = ImmutableMap.builder(); attachments.forEach((name, value) -> { try { builder.put(name, new AttachmentImpl(name, toDataHandler(name, value.getContent(), value.getContentType()))); } catch (IOException e) { throw new BadRequestException(format("Error while preparing attachment [%s] for upload", name), e); } }); return builder.build(); }
@Override protected Attachment createAttachment(Object object, String id) { byte[] data = (byte[])object; ByteDataSource source = new ByteDataSource(data); source.setContentType(getContentType(object, null)); AttachmentImpl att = new AttachmentImpl(id, new DataHandler(source)); att.setXOP(true); return att; }
@Override protected Attachment createAttachment(Object object, String id) { byte[] data = (byte[])object; ByteDataSource source = new ByteDataSource(data); source.setContentType(getContentType(object, null)); AttachmentImpl att = new AttachmentImpl(id, new DataHandler(source)); att.setXOP(true); return att; }