refactor the post multipartfile
This commit is contained in:
parent
9fc26763bd
commit
24ffcd6925
|
@ -134,7 +134,9 @@ public class HttpRequester {
|
|||
}
|
||||
Part[] parts = new Part[files.size() + strings.size()];
|
||||
for (int i = 0; i < files.size(); i++) {
|
||||
parts[i] = new FilePart(filePartName, files.get(i));
|
||||
FilePart filePart = new FilePart(filePartName, files.get(i)
|
||||
.getName(), files.get(i));
|
||||
parts[i] = filePart;
|
||||
}
|
||||
for (int i = 0; i < strings.size(); i++) {
|
||||
parts[i + files.size()] = new StringPart(stringPartName,
|
||||
|
@ -157,14 +159,16 @@ public class HttpRequester {
|
|||
List<File> files = new LinkedList<File>();
|
||||
if (multipartFiles != null) {
|
||||
for (MultipartFile multipartFile : multipartFiles) {
|
||||
File file = new File("paramFile.txt");
|
||||
File file = new File(multipartFile.getOriginalFilename());
|
||||
multipartFile.transferTo(file);
|
||||
files.add(file);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return postFiles(headers, url, filePartName, files, stringPartName,
|
||||
strings);
|
||||
|
||||
}
|
||||
|
||||
private HttpResponse send(String urlString, String method,
|
||||
|
|
|
@ -10,6 +10,9 @@ public class UserModel {
|
|||
private String password;
|
||||
private byte scope;
|
||||
|
||||
public UserModel(){
|
||||
|
||||
}
|
||||
@XmlElement
|
||||
public int getId() {
|
||||
return id;
|
||||
|
|
Loading…
Reference in New Issue