public static DataSource getAttachmentDataSource(String contentId, Collection<Attachment> atts) { // Is this right? - DD if (contentId.startsWith("cid:")) { try { contentId = URLDecoder.decode(contentId.substring(4), StandardCharsets.UTF_8.name()); } catch (UnsupportedEncodingException ue) { contentId = contentId.substring(4); } return loadDataSource(contentId, atts); } else if (contentId.indexOf("://") == -1) { return loadDataSource(contentId, atts); } else { try { return new URLDataSource(new URL(contentId)); } catch (MalformedURLException e) { throw new Fault(e); } } }
public static DataSource getAttachmentDataSource(String contentId, Collection<Attachment> atts) { // Is this right? - DD if (contentId.startsWith("cid:")) { try { contentId = URLDecoder.decode(contentId.substring(4), StandardCharsets.UTF_8.name()); } catch (UnsupportedEncodingException ue) { contentId = contentId.substring(4); } return loadDataSource(contentId, atts); } else if (contentId.indexOf("://") == -1) { return loadDataSource(contentId, atts); } else { try { return new URLDataSource(new URL(contentId)); } catch (MalformedURLException e) { throw new Fault(e); } } }
public static DataSource getAttachmentDataSource(String contentId, Collection<Attachment> atts) { // Is this right? - DD if (contentId.startsWith("cid:")) { try { contentId = URLDecoder.decode(contentId.substring(4), "UTF-8"); } catch (UnsupportedEncodingException ue) { contentId = contentId.substring(4); } return loadDataSource(contentId, atts); } else if (contentId.indexOf("://") == -1) { return loadDataSource(contentId, atts); } else { try { return new URLDataSource(new URL(contentId)); } catch (MalformedURLException e) { throw new Fault(e); } } }
public static DataSource getAttachmentDataSource(String contentId, Collection<Attachment> atts) { // Is this right? - DD if (contentId.startsWith("cid:")) { try { contentId = URLDecoder.decode(contentId.substring(4), "UTF-8"); } catch (UnsupportedEncodingException ue) { contentId = contentId.substring(4); } return loadDataSource(contentId, atts); } else if (contentId.indexOf("://") == -1) { return loadDataSource(contentId, atts); } else { try { return new URLDataSource(new URL(contentId)); } catch (MalformedURLException e) { throw new Fault(e); } } }