List of usage examples for javax.mail.internet ParseException toString
@Override public synchronized String toString()
From source file:com.adaptris.core.http.client.net.StandardHttpProducer.java
private String getContentEncoding(HttpURLConnection http) { if (http.getContentEncoding() != null) { return http.getContentEncoding(); }/* ww w. j a va 2 s . c om*/ // Parse Content-Type header for encoding try { ContentType contentType = new ContentType(http.getContentType()); if (!isEmpty(contentType.getParameter(PARAM_CHARSET))) { return contentType.getParameter(PARAM_CHARSET); } } catch (ParseException e) { log.trace("Unable to parse Content-Type header \"{}\": {}", http.getContentType(), e.toString()); } return null; }
From source file:com.duroty.utils.mail.MessageUtilities.java
/** * Get the content dispostion of a part. The part is interogated for a * valid content disposition. If the content disposition is missing, a * default disposition is created based on the type of the part. * * @param part The part to interogate/* w ww.j a v a 2 s .c o m*/ * * @return ContentDisposition of the part * * @throws MessagingException DOCUMENT ME! * * @see javax.mail.Part */ public static ContentDisposition getContentDisposition(Part part) throws MessagingException { String[] xheaders = part.getHeader("Content-Disposition"); try { if (xheaders != null) { return new ContentDisposition(xheaders[0]); } } catch (ParseException xex) { throw new MessagingException(xex.toString()); } // set default disposition based on part type if (part instanceof MimeBodyPart) { return new ContentDisposition("attachment"); } return new ContentDisposition("inline"); }