@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; }
} else if (byte[].class.isAssignableFrom(obj.getClass())) { ByteDataSource source = new ByteDataSource((byte[])obj); source.setContentType(mimeType); dh = new DataHandler(source); } else {
} else if (byte[].class.isAssignableFrom(obj.getClass())) { ByteDataSource source = new ByteDataSource((byte[])obj); source.setContentType(mimeType); dh = new DataHandler(source); } else {
public static Attachment createMtomAttachment(boolean isXop, String mimeType, String elementNS, byte[] data, int offset, int length, int threshold) { if (!isXop || length <= threshold) { return null; } if (mimeType == null) { mimeType = "application/octet-stream"; } ByteDataSource source = new ByteDataSource(data, offset, length); source.setContentType(mimeType); DataHandler handler = new DataHandler(source); String id; try { id = AttachmentUtil.createContentID(elementNS); } catch (UnsupportedEncodingException e) { throw new Fault(e); } AttachmentImpl att = new AttachmentImpl(id, handler); att.setXOP(isXop); return att; }
public static Attachment createMtomAttachment(boolean isXop, String mimeType, String elementNS, byte[] data, int offset, int length, int threshold) { if (!isXop || length <= threshold) { return null; } if (mimeType == null) { mimeType = "application/octet-stream"; } ByteDataSource source = new ByteDataSource(data, offset, length); source.setContentType(mimeType); DataHandler handler = new DataHandler(source); String id; try { id = AttachmentUtil.createContentID(elementNS); } catch (UnsupportedEncodingException e) { throw new Fault(e); } AttachmentImpl att = new AttachmentImpl(id, handler); att.setXOP(isXop); return att; }
public static Attachment createMtomAttachment(boolean isXop, String mimeType, String elementNS, byte[] data, int offset, int length, int threshold) { if (!isXop || length <= threshold) { return null; } if (mimeType == null) { mimeType = "application/octet-stream"; } ByteDataSource source = new ByteDataSource(data, offset, length); source.setContentType(mimeType); DataHandler handler = new DataHandler(source); String id; try { id = AttachmentUtil.createContentID(elementNS); } catch (UnsupportedEncodingException e) { throw new Fault(e); } AttachmentImpl att = new AttachmentImpl(id, handler); att.setXOP(isXop); return att; }
public static Attachment createMtomAttachment(boolean isXop, String mimeType, String elementNS, byte[] data, int offset, int length, int threshold) { if (!isXop || length <= threshold) { return null; } if (mimeType == null) { mimeType = "application/octet-stream"; } ByteDataSource source = new ByteDataSource(data, offset, length); source.setContentType(mimeType); DataHandler handler = new DataHandler(source); String id; try { id = AttachmentUtil.createContentID(elementNS); } catch (UnsupportedEncodingException e) { throw new Fault(e); } AttachmentImpl att = new AttachmentImpl(id, handler); att.setXOP(isXop); return att; }