'Dropwizard HttpClient Multipart http Request - Java
I am getting Multipart request from UI to upload csv file but call is going through one orchestrator service (dropwizard-version : 0.9.2) to target service (dropwizard-version : 1.2.2) for upload. While adding support for Multipart request in orchestrator service using MultipartRequestEntity, call is failing at target service with error -
[2022-03-08 16:23:44,474] io.dropwizard.jersey.errors.LoggingExceptionMapper: Error handling a request: 4c0693ee31713edf
! java.util.concurrent.TimeoutException: Idle timeout expired: 30005/30000 ms
! at org.eclipse.jetty.io.IdleTimeout.checkIdleTimeout(IdleTimeout.java:166)
! at org.eclipse.jetty.io.IdleTimeout$1.run(IdleTimeout.java:50)
Expected Request at Resource Layer for both services :
public void request(@FormDataParam("file") InputStream body,
@FormDataParam("file") FormDataContentDisposition fileDetails,
@FormDataParam("comment") String comment){}
Is there any solution for this?
Solution 1:[1]
In this case tried using JerseyClient instead of HTTP Client in orchestrator service for making call to target service, created temporary csv file in orchestrator service and sent updated Headers (Content-Type, Content-Encoding, Content-Length, Content-Language, Host) while making call to target service, which is working fine.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Abhishek |
