Search in sources :

Example 1 with ParameterList

use of javax.mail.internet.ParameterList in project rest.li by linkedin.

the class MIMETestUtils method createBodyLessBody.

private static final MimeBodyPart createBodyLessBody() {
    try {
        //Body-less body. This has no body but does have headers, some of which are folded.
        final MimeBodyPart dataPart = new MimeBodyPart();
        final ParameterList parameterList = new ParameterList();
        parameterList.set("AVeryVeryVeryVeryLongHeader", "AVeryVeryVeryVeryLongValue");
        parameterList.set("AVeryVeryVeryVeryLongHeader2", "AVeryVeryVeryVeryLongValue2");
        parameterList.set("AVeryVeryVeryVeryLongHeader3", "AVeryVeryVeryVeryLongValue3");
        parameterList.set("AVeryVeryVeryVeryLongHeader4", "AVeryVeryVeryVeryLongValue4");
        final ContentType contentType = new ContentType("text", "plain", parameterList);
        dataPart.setContent("", contentType.getBaseType());
        dataPart.setHeader(HEADER_CONTENT_TYPE, contentType.toString());
        dataPart.setHeader("YetAnotherCustomHeader", "YetAnotherCustomValue");
        return dataPart;
    } catch (Exception exception) {
        Assert.fail();
    }
    return null;
}
Also used : ContentType(javax.mail.internet.ContentType) ParameterList(javax.mail.internet.ParameterList) MimeBodyPart(javax.mail.internet.MimeBodyPart) IOException(java.io.IOException)

Aggregations

IOException (java.io.IOException)1 ContentType (javax.mail.internet.ContentType)1 MimeBodyPart (javax.mail.internet.MimeBodyPart)1 ParameterList (javax.mail.internet.ParameterList)1