title: 413 Request Entity Too Large - With Spring Boot and Rest Template
body: <p>Using Spring Rest Template to upload a 100 MB file, using a multipart post request.</p>
  
  <p>Client Code:</p>
  
  <pre><code>HttpHeaders headers = new HttpHeaders();
      headers.setContentType(MediaType.MULTIPART_FORM_DATA);
      MultiValueMap&lt;String, Object&gt; map = new LinkedMultiValueMap&lt;String, Object&gt;();
  
      map.add("name", chunk.getFilename());
      map.add("filename", chunk.getFilename());
      map.add("flowChunkNumber", chunk.getNumber());
      map.add("flowChunkSize", chunkSize);
      map.add("flowIdentifier", chunk.getIdentifier());
      map.add("flowTotalSize", chunk.getTotalSize());
      map.add("flowCurrentChunkSize", chunk.getSize());
      map.add("file", chunk.getResource() );
  
      HttpEntity&lt;MultiValueMap&lt;String, Object&gt;&gt; entity = new HttpEntity&lt;MultiValueMap&lt;String, Object&gt;&gt;(map, headers);
  
  
      ResponseEntity&lt;String&gt; response = executeForResponse(
              baseUri().path("/api/v1/uploads/chunks")
                                          .build().toUri(), HttpMethod.POST, entity, String.class);
  </code></pre>
  
  <p>However the server ( Springs Boot application deployed on Amazon AWS ) returns :</p>
  
  <pre><code>org.springframework.web.client.HttpClientErrorException: 413 Request Entity Too Large
      at org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:91)
      at org.springframework.web.client.RestTemplate.handleResponse(RestTemplate.java:614)
      at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:570)
      at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:545)
      at org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:466)
  </code></pre>
  
  <p>Strangely enough I can upload the same file using an angular JS code to the same Spring Boot application.</p>
  
  <p>Though in angular code I use : forceChunkSize : true</p>
  
  <p>Can I do the same in java ?</p>