/* *AdaptedfromFileUploadBase.getFileName()
*/
@Override public String getSubmittedFileName() {
String fileName = null;
String cd = getHeader("Content-Disposition"); if (cd != null) {
String cdl = cd.toLowerCase(Locale.ENGLISH); if (cdl.startsWith("form-data") || cdl.startsWith("attachment")) {
ParameterParser paramParser = new ParameterParser();
paramParser.setLowerCaseNames(true); // Parameter parser can handle null input
Map<String,String> params = paramParser.parse(cd, ';'); if (params.containsKey("filename")) {
fileName = params.get("filename"); // The parser will remove surrounding '"' but will not // unquote any \x sequences. if (fileName != null) { // RFC 6266. This is either a token or a quoted-string if (fileName.indexOf('\\') > -1) { // This is a quoted-string
fileName = HttpParser.unquote(fileName.trim());
} else { // This is a token
fileName = fileName.trim();
}
} else { // Even if there is no value, the parameter is present, // so we return an empty file name rather than no file // name.
fileName = "";
}
}
}
} return fileName;
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.