I am trying to add proxy support to my Jersey Client. I use org.glassfish.jersey.core:jersey-client:2.11 but I can switch to any Jersey Client 2 version. Currently the client uses the default Jersey connector which does not support proxy AFAIK.
I have tried solution described here How to add a http proxy for Jersey2 Client but then when sending a multipart content I get:
org.apache.commons.fileupload.FileUploadException: the request was rejected because no multipart boundary was found
and the WARNING in the client:
Aug 10, 2015 5:10:32 PM org.glassfish.jersey.message.internal.HeaderUtils checkHeaderChanges
WARNING: There are some request headers that have not been sent by connector [org.glassfish.jersey.apache.connector.ApacheConnector]. Probably you added those headers in WriterInterceptor or MessageBodyWriter. That feature is not supported by the connector. Please, do not modify headers in WriterInterceptor or MessageBodyWriter or use default HttpUrlConnector instead.
Unsent header changes: [MIME-Version, Content-Type]
Also Jersey Client 2 documentation mentioned the issue (https://jersey.java.net/documentation/latest/user-guide.html#d0e9179)
Warning
Do not use ApacheConnectorProvider nor GrizzlyConnectorProvider neither JettyConnectorProvider connector implementations with Jersey Multipart features. See Header modification issue warning for more details.
What is the way of configuring Jersey Client 2 to support both:
- Sending multipart content (for uploading files on the server)
- Proxy server support
?
PS. Maybe there is a way of adding proxy support to the default jersey connector implementation?