Package javax.mail.internet

Examples of javax.mail.internet.ContentDisposition


        MockHttpServletResponse response = new MockHttpServletResponse();
        resolution.applyHeaders(response);
        resolution.stream(response);
        Assert.assertEquals(data, response.getOutputBytes());

        ContentDisposition disposition = getContentDisposition(response);
        if (attachment) {
            if (filename == null) {
                Assert.assertNotNull(disposition);
                Assert.assertEquals("attachment", disposition.getDisposition());
                Assert.assertNull(disposition.getParameter("filename"));
            }
            else {
                Assert.assertNotNull(disposition);
                Assert.assertEquals("attachment", disposition.getDisposition());
                Assert.assertNotNull(disposition.getParameter("filename"));
            }
        }
        else {
            if (filename == null) {
                Assert.assertNull(disposition);
            }
            else {
                Assert.assertNotNull(disposition);
                Assert.assertEquals("attachment", disposition.getDisposition());
                Assert.assertNotNull(disposition.getParameter("filename"));
            }
        }
    }
View Full Code Here


            throws ParseException {
        final List<Object> list = response.getHeaderMap().get("Content-Disposition");
        if (list == null || list.isEmpty())
            return null;
        else
            return new ContentDisposition(list.get(0).toString());
    }
View Full Code Here

  public static String detectFilename(HttpHeaders httpHeaders) {

    List<String> disposition = httpHeaders.getRequestHeader("Content-Disposition");
    if (disposition != null && !disposition.isEmpty()) {
      try {
        ContentDisposition c = new ContentDisposition(disposition.get(0));

        // only support "attachment" dispositions
        if ("attachment".equals(c.getDisposition())) {
          String fn = c.getParameter("filename");
          if (fn != null) {
            return fn;
          }
        }
      } catch (ParseException e) {
View Full Code Here

  public static String detectFilename(MultivaluedMap<String, String> httpHeaders) {

    String disposition = httpHeaders.getFirst("Content-Disposition");
    if (disposition != null) {
      try {
        ContentDisposition c = new ContentDisposition(disposition);

        // only support "attachment" dispositions
        if ("attachment".equals(c.getDisposition())) {
          String fn = c.getParameter("filename");
          if (fn != null) {
            return fn;
          }
        }
      } catch (ParseException e) {
View Full Code Here

TOP

Related Classes of javax.mail.internet.ContentDisposition

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.