From 5033ad8ebb4a182b614fb18b3c432ab91247efc4 Mon Sep 17 00:00:00 2001 From: Payam Meyer Date: Thu, 30 Jan 2020 20:53:39 -0500 Subject: [PATCH] Increased the upload file size limit. Fixed issue with null metadata. --- .../main/java/io/zulia/client/ZuliaRESTClient.java | 12 ++++++++---- zulia-server/src/main/resources/application.yml | 4 ++++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/zulia-client/src/main/java/io/zulia/client/ZuliaRESTClient.java b/zulia-client/src/main/java/io/zulia/client/ZuliaRESTClient.java index e93e9dcc..f77966ab 100644 --- a/zulia-client/src/main/java/io/zulia/client/ZuliaRESTClient.java +++ b/zulia-client/src/main/java/io/zulia/client/ZuliaRESTClient.java @@ -89,10 +89,14 @@ public void storeAssociated(String uniqueId, String indexName, String fileName, String url = HttpHelper.createRequestUrl(server, restPort, ZuliaConstants.ASSOCIATED_DOCUMENTS_URL, null); try (HttpClient client = HttpClient.create(new URI(url).toURL())) { - MultipartBody requestBody = MultipartBody.builder().addPart("id", uniqueId).addPart("index", indexName).addPart("fileName", fileName) - .addPart("metaJson", metadata != null ? metadata.toJson() : null).addPart("file", fileName, MediaType.forFilename(fileName), source, 0) - .build(); - client.toBlocking().exchange(HttpRequest.POST(url, requestBody).contentType(MediaType.MULTIPART_FORM_DATA), String.class); + MultipartBody.Builder builder = MultipartBody.builder().addPart("id", uniqueId).addPart("index", indexName).addPart("fileName", fileName) + .addPart("file", fileName, MediaType.forFilename(fileName), source, 0); + + if (metadata != null) { + builder.addPart("metaJson", metadata.toJson()); + } + + client.toBlocking().exchange(HttpRequest.POST(url, builder.build()).contentType(MediaType.MULTIPART_FORM_DATA), String.class); } } diff --git a/zulia-server/src/main/resources/application.yml b/zulia-server/src/main/resources/application.yml index 3f63274a..6d9a7944 100644 --- a/zulia-server/src/main/resources/application.yml +++ b/zulia-server/src/main/resources/application.yml @@ -5,6 +5,10 @@ micronaut: enabled: true netty: log-level: TRACE + multipart: + max-file-size: 1024MB + max-request-size: 250MB + enabled: true application: name: zulia-service router: