Created
September 19, 2013 20:45
-
-
Save lifuzu/6629594 to your computer and use it in GitHub Desktop.
Get filename option from http request header
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @param part | |
* @return | |
*/ | |
private String getFileName(final Part part) { | |
final String partHeader = part.getHeader("content-disposition"); | |
for (String content : partHeader.split(";")) { | |
if (content.trim().startsWith("filename")) { | |
return content.substring(content.indexOf('=') + 1).trim().replace("\"", ""); | |
} | |
} | |
return null; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment