|
68 | 68 | * List<String> list = new ArrayList<String>(); // Ordered collection
|
69 | 69 | * list.add("Java");
|
70 | 70 | * list.add("C");
|
71 |
| - * params.put("languages", list); // url params: "languages[]=Java&languages[]=C" |
| 71 | + * params.put("languages", list); // url params: "languages[0]=Java&languages[1]=C" |
72 | 72 | *
|
73 | 73 | * String[] colors = { "blue", "yellow" }; // Ordered collection
|
74 |
| - * params.put("colors", colors); // url params: "colors[]=blue&colors[]=yellow" |
| 74 | + * params.put("colors", colors); // url params: "colors[0]=blue&colors[1]=yellow" |
75 | 75 | *
|
76 | 76 | * File[] files = { new File("pic.jpg"), new File("pic1.jpg") }; // Ordered collection
|
77 | 77 | * params.put("files", files); // url params: "files[]=pic.jpg&files[]=pic1.jpg"
|
@@ -228,11 +228,11 @@ public void put(String key, File files[], String contentType, String customFileN
|
228 | 228 |
|
229 | 229 | if (key != null) {
|
230 | 230 | List<FileWrapper> fileWrappers = new ArrayList<FileWrapper>();
|
231 |
| - for (int i = 0; i < files.length; i++) { |
232 |
| - if (files[i] == null || !files[i].exists()) { |
| 231 | + for (File file : files) { |
| 232 | + if (file == null || !file.exists()) { |
233 | 233 | throw new FileNotFoundException();
|
234 | 234 | }
|
235 |
| - fileWrappers.add(new FileWrapper(files[i], contentType, customFileName)); |
| 235 | + fileWrappers.add(new FileWrapper(file, contentType, customFileName)); |
236 | 236 | }
|
237 | 237 | fileArrayParams.put(key, fileWrappers);
|
238 | 238 | }
|
@@ -460,7 +460,7 @@ public String toString() {
|
460 | 460 |
|
461 | 461 | result.append(entry.getKey());
|
462 | 462 | result.append("=");
|
463 |
| - result.append("FILE"); |
| 463 | + result.append("FILES(SIZE=").append(entry.getValue().size()).append(")"); |
464 | 464 | }
|
465 | 465 |
|
466 | 466 | List<BasicNameValuePair> params = getParamsList(null, urlParamsWithObjects);
|
|
0 commit comments