org.apache.commons.fileupload.ParameterParser Java Examples

The following examples show how to use org.apache.commons.fileupload.ParameterParser. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DiskFileItem.java    From Mars-Java with MIT License 5 votes vote down vote up
/**
 * Returns the content charset passed by the agent or <code>null</code> if
 * not defined.
 *
 * @return The content charset passed by the agent or <code>null</code> if
 *         not defined.
 */
public String getCharSet() {
    ParameterParser parser = new ParameterParser();
    parser.setLowerCaseNames(true);
    // Parameter parser can handle null input
    Map<String, String> params = parser.parse(getContentType(), ';');
    return params.get("charset");
}
 
Example #2
Source File: DiskFileItem.java    From onedev with MIT License 5 votes vote down vote up
/**
 * Returns the content charset passed by the agent or <code>null</code> if
 * not defined.
 *
 * @return The content charset passed by the agent or <code>null</code> if
 *         not defined.
 */
public String getCharSet() {
    ParameterParser parser = new ParameterParser();
    parser.setLowerCaseNames(true);
    // Parameter parser can handle null input
    Map<String, String> params = parser.parse(getContentType(), ';');
    return params.get("charset");
}
 
Example #3
Source File: DiskFileItem.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns the content charset passed by the agent or <code>null</code> if
 * not defined.
 *
 * @return The content charset passed by the agent or <code>null</code> if
 *         not defined.
 */
public String getCharSet() {
    ParameterParser parser = new ParameterParser();
    parser.setLowerCaseNames(true);
    // Parameter parser can handle null input
    Map<String, String> params = parser.parse(getContentType(), ';');
    return params.get("charset");
}
 
Example #4
Source File: UploadComponentMultipartHelper.java    From nexus-public with Eclipse Public License 1.0 5 votes vote down vote up
private String getCharSet(final String contentType) {
  ParameterParser parser = new ParameterParser();
  parser.setLowerCaseNames(true);
  // Parameter parser can handle null input
  Map<String, String> params = parser.parse(contentType, ';');
  return params.getOrDefault("charset", Charsets.UTF_8.name());
}
 
Example #5
Source File: DiskFileItem.java    From AndroidWebServ with Apache License 2.0 5 votes vote down vote up
/**
 * Returns the content charset passed by the agent or <code>null</code> if
 * not defined.
 *
 * @return The content charset passed by the agent or <code>null</code> if
 *         not defined.
 */
public String getCharSet() {
    ParameterParser parser = new ParameterParser();
    parser.setLowerCaseNames(true);
    // Parameter parser can handle null input
    Map<String, String> params = parser.parse(getContentType(), ';');
    return params.get("charset");
}
 
Example #6
Source File: HttpGetParser.java    From AndroidWebServ with Apache License 2.0 2 votes vote down vote up
/**
 * @brief 解析请求的get信息
 * @param request Http请求
 * @return 名称与值的Map集合
 * @throws IOException
 * @warning 需保证是post请求且不是multipart的。
 */
public Map<String, String> parse(HttpRequest request) {
    ParameterParser parser = new ParameterParser();
    parser.setLowerCaseNames(true);
    return parser.parse(getContent(request), '&');
}
 
Example #7
Source File: HttpPostParser.java    From AndroidWebServ with Apache License 2.0 2 votes vote down vote up
/**
 * @brief 解析请求的post信息
 * @param request Http请求
 * @return 名称与值的Map集合
 * @throws IOException
 * @warning 需保证是post请求且不是multipart的。
 */
public Map<String, String> parse(HttpRequest request) throws IOException {
    ParameterParser parser = new ParameterParser();
    parser.setLowerCaseNames(true);
    return parser.parse(getContent(request), '&');
}