// In this case we setup the parameter from a multipart request
File file = null;
for (BodyPart bpart : data.getBodyParts()) {
log.debug("is a {}", bpart.getClass());
if (bpart instanceof FormDataBodyPart) {
FormDataBodyPart dbp = (FormDataBodyPart) bpart;
if (dbp.getName().equals("file")) {
file = bpart.getEntityAs(File.class);
}
// We put all the parameters field
// XXX We supports here only simple fields
// We do NOT support the sent of additional files, for
// example
if (dbp.isSimple()) {
if (this.parameters.containsKey(dbp.getName())) {
this.parameters.get(dbp.getName()).add(dbp.getValue());
} else {
List<String> values = new ArrayList<String>();
values.add(dbp.getValue());
this.parameters.put(dbp.getName(), values);
}
}
}
}
// Then add the file