}
String cdName = cd == null ? null : cd.getParameter("name");
String contentId = a.getContentId();
String name = StringUtils.isEmpty(cdName) ? contentId : cdName.replace("\"", "").replace("'", "");
if (StringUtils.isEmpty(name)) {
throw new BadRequestException();
}
if (CONTENT_DISPOSITION_FILES_PARAM.equals(name)) {
// this is a reserved name in Content-Disposition for parts containing files
continue;
}
try {
String value = IOUtils.toString(a.getDataHandler().getInputStream());
params.add(HttpUtils.urlDecode(name),
decode ? HttpUtils.urlDecode(value) : value);
} catch (IllegalArgumentException ex) {
LOG.warning("Illegal URL-encoded characters, make sure that no "
+ "@FormParam and @Multipart annotations are mixed up");
throw new InternalServerErrorException();
} catch (IOException ex) {
throw new BadRequestException();
}
}
}