@Test public void testContentDispositionParsing() throws Exception { final String contentDisposition = "attachment; filename=\"plans.pdf\""; final Util.ParsedContentDisposition parsed = Util.parseContentDisposition(contentDisposition); assertNotNull(parsed); assertEquals("plans.pdf", parsed.getFileName()); assertEquals("attachment", parsed.getContentDispositionType()); }
public static ParsedContentDisposition parseContentDisposition(String contentDisposition) { Matcher m = CONTENT_DISPOSITION_PATTERN.matcher(contentDisposition); if (m.find() && m.groupCount() == 2) { return new ParsedContentDisposition(m.group(1), m.group(2)); } return null; }
Util { public static ParsedContentDisposition parseContentDisposition(String contentDisposition) { Matcher m = CONTENT_DISPOSITION_PATTERN.matcher(contentDisposition); if (m.find() && m.groupCount() == 2) { return new ParsedContentDisposition(m.group(1), m.group(2)); } return null; } }
Util { public static ParsedContentDisposition parseContentDisposition(String contentDisposition) { Matcher m = CONTENT_DISPOSITION_PATTERN.matcher(contentDisposition); if (m.find() && m.groupCount() == 2) { return new ParsedContentDisposition(m.group(1), m.group(2)); } return null; }  }
Util { public static ParsedContentDisposition parseContentDisposition(String contentDisposition) { Matcher m = CONTENT_DISPOSITION_PATTERN.matcher(contentDisposition); if (m.find() && m.groupCount() == 2) { return new ParsedContentDisposition(m.group(1), m.group(2)); } return null; }  static ParsedContentDisposition parseContentDisposition(String contentDisposition); }
Util { public static ParsedContentDisposition parseContentDisposition(String contentDisposition) { Matcher m = CONTENT_DISPOSITION_PATTERN.matcher(contentDisposition); if (m.find() && m.groupCount() == 2) { return new ParsedContentDisposition(m.group(1), m.group(2)); } return null; }  static ParsedContentDisposition parseContentDisposition(String contentDisposition);  }