public static String detectFilename(MultivaluedMap<String, String> httpHeaders) { String disposition = httpHeaders.getFirst("Content-Disposition"); if (disposition != null) { ContentDisposition c = new ContentDisposition(disposition); // only support "attachment" dispositions if ("attachment".equals(c.getType())) { String fn = c.getParameter("filename"); if (fn != null) { return fn; } } } // this really should not be used, since it's not an official field return httpHeaders.getFirst("File-Name"); }
static String getContentDispositionFileName(String cd) { if (StringUtils.isEmpty(cd)) { return null; } ContentDisposition c = new ContentDisposition(cd); String s = c.getParameter("filename"); if (s == null) { s = c.getParameter("name"); } return s; }
static String getContentDispositionFileName(String cd) { if (StringUtils.isEmpty(cd)) { return null; } ContentDisposition c = new ContentDisposition(cd); String s = c.getParameter("filename"); if (s == null) { s = c.getParameter("name"); } return s; }
static String getContentDispositionFileName(String cd) { if (StringUtils.isEmpty(cd)) { return null; } //TODO: save ContentDisposition directly ContentDisposition c = new ContentDisposition(cd); String s = c.getParameter("filename"); if (s == null) { s = c.getParameter("name"); } return s; }
static String getContentDispositionFileName(String cd) { if (StringUtils.isEmpty(cd)) { return null; } //TODO: save ContentDisposition directly ContentDisposition c = new ContentDisposition(cd); String s = c.getParameter("filename"); if (s == null) { s = c.getParameter("name"); } return s; }