@Test public void testJAXBAndActivationDependency() { //TIKA-2778 AttachmentUtil.getCommandMap(); }
private String findBoundary(String ct) { int idx = ct.indexOf("boundary="); if (idx == -1) { return AttachmentUtil.getUniqueBoundaryValue(); } ct = ct.substring(idx + 9); if (ct.charAt(0) == '"') { ct = ct.substring(1); idx = ct.indexOf('"'); return ct.substring(0, idx); } idx = ct.indexOf(';'); if (idx == -1) { return ct; } return ct.substring(0, idx); } }
public String addMtomAttachment(byte[] data, int offset, int length, String mimeType, String elementNS, String elementLocalName) { Attachment att = AttachmentUtil.createMtomAttachment( isXop, mimeType, elementNS, data, offset, length, threshold); if (att != null) { atts.add(att); return "cid:" + att.getId(); } return null; }
if (!AttachmentUtil.isMtomEnabled(outMessage)) { rootHeaders.putSingle(Message.CONTENT_TYPE, rootContentType);
public static Attachment createAttachment(InputStream stream, Map<String, List<String>> headers) throws IOException { String id = cleanContentId(getHeader(headers, "Content-ID")); final String ct = getHeader(headers, "Content-Type"); String cd = getHeader(headers, "Content-Disposition"); String fileName = getContentDispositionFileName(cd); String name = e.getKey(); if ("Content-Transfer-Encoding".equalsIgnoreCase(name)) { encoding = getHeader(headers, name); if ("binary".equalsIgnoreCase(encoding)) { att.setXOP(true); att.setHeader(name, getHeaderValue(e.getValue())); InputStream ins = decode(stream, encoding); if (ins != stream) { headers.remove("Content-Transfer-Encoding");
public static Attachment createAttachment(InputStream stream, InternetHeaders headers) throws IOException { String id = cleanContentId(headers.getHeader("Content-ID", null)); String fileName = getContentDispositionFileName(cd);
/** * Create an Attachment from the MIME stream. If there is a previous attachment * that is not read, cache that attachment. * * @throws IOException */ private Attachment createAttachment(Map<String, List<String>> headers) throws IOException { InputStream partStream = new DelegatingInputStream(new MimeBodyPartInputStream(stream, boundary, PUSHBACK_AMOUNT), this); createCount++; return AttachmentUtil.createAttachment(partStream, headers); }
id = AttachmentUtil.createContentID(elementNS); } catch (UnsupportedEncodingException e) { throw new Fault(e);
@Override public DataHandler getAttachmentAsDataHandler(String contentId) { return new DataHandler(AttachmentUtil.getAttachmentDataSource(contentId, attachments)); }
while (it.hasNext()) { AttachmentPart part = it.next(); String id = AttachmentUtil.cleanContentId(part.getContentId()); AttachmentImpl att = new AttachmentImpl(id); try {
public String addMtomAttachment(DataHandler handler, String elementNS, String elementLocalName) { Attachment att = AttachmentUtil.createMtomAttachmentFromDH(isXop, handler, elementNS, threshold); if (att != null) { atts.add(att); return "cid:" + att.getId(); } return null; }
if (!AttachmentUtil.isMtomEnabled(outMessage)) { rootHeaders.putSingle(Message.CONTENT_TYPE, rootContentType);
public static Attachment createAttachment(InputStream stream, Map<String, List<String>> headers) throws IOException { String id = cleanContentId(getHeader(headers, "Content-ID")); final String ct = getHeader(headers, "Content-Type"); String cd = getHeader(headers, "Content-Disposition"); String fileName = getContentDispositionFileName(cd); String name = e.getKey(); if ("Content-Transfer-Encoding".equalsIgnoreCase(name)) { encoding = getHeader(headers, name); if ("binary".equalsIgnoreCase(encoding)) { att.setXOP(true); att.setHeader(name, getHeaderValue(e.getValue())); InputStream ins = decode(stream, encoding); if (ins != stream) { headers.remove("Content-Transfer-Encoding");
public static Attachment createAttachment(InputStream stream, InternetHeaders headers) throws IOException { String id = cleanContentId(headers.getHeader("Content-ID", null)); String fileName = getContentDispositionFileName(cd);
/** * Create an Attachment from the MIME stream. If there is a previous attachment * that is not read, cache that attachment. * * @throws IOException */ private Attachment createAttachment(Map<String, List<String>> headers) throws IOException { InputStream partStream = new DelegatingInputStream(new MimeBodyPartInputStream(stream, boundary, PUSHBACK_AMOUNT), this); createCount++; return AttachmentUtil.createAttachment(partStream, headers); }
id = AttachmentUtil.createContentID(elementNS); } catch (UnsupportedEncodingException e) { throw new Fault(e);
@Override public DataHandler getAttachmentAsDataHandler(String contentId) { return new DataHandler(AttachmentUtil.getAttachmentDataSource(contentId, attachments)); }
while (it.hasNext()) { AttachmentPart part = it.next(); String id = AttachmentUtil.cleanContentId(part.getContentId()); AttachmentImpl att = new AttachmentImpl(id); try {
public String addMtomAttachment(DataHandler handler, String elementNS, String elementLocalName) { Attachment att = AttachmentUtil.createMtomAttachmentFromDH(isXop, handler, elementNS, threshold); if (att != null) { atts.add(att); lastElementName = new QName(elementNS, elementLocalName); return "cid:" + att.getId(); } return null; }
message, SecurityConstants.STORE_BYTES_IN_ATTACHMENT, true ); boolean mtomEnabled = AttachmentUtil.isMtomEnabled(message); if (storeBytes && mtomEnabled) { storeBytesInAttachment = true;