#Exchange does not send MultiPartFile and explodes

1 messages · Page 1 of 1 (latest)

leaden scaffold
#

Exchange does not send MultiPartFile and explodes, the file is load in memory dosnt send in parts, this is the method, any idea?

  public void create(CreateCollectionRequest cmd) {
        final CreateCollectionRestModel request = CreateCollectionRestModel.from(cmd);
        log.info("Creating collection with {}", request);
        final URI uri = UriComponentsBuilder.fromUriString(config.Repository().getUrl() + COLLECTION_RESOURCE)
                .queryParam("code",160)
                .build().toUri();

        MultiValueMap<String, Object> body = new LinkedMultiValueMap<>();
        //File tempFile = File.createTempFile("xyz", "");
        //FileCopyUtils.copy(multipartFile.getInputStream(), new FileOutputStream(tempFile));

        body.add("file", cmd.getContent().getResource());
        HttpEntity<MultiValueMap<String, Object>> httpEntity =
                new HttpEntity<>(body, headersProvider.get("xxxx", "xxxx"));

        restTemplate.exchange(
                                uri,
                                HttpMethod.POST,
                                httpEntity,
                                Object.class)
                        .getBody();
    }
distant berryBOT
#

This post has been reserved for your question.

Hey @leaden scaffold! Please use /close or the Close Post button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.

TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.

distant berryBOT