I'm trying to setup a proxy in my java code using Jersey client but the proxy is not getting set. I went through the Jersey documentation and have implemented the code in the described way. I'm new to Jersey so not sure where I'm going wrong.
Below is the code.
@Override
@CircuitBreaker(name = "documentServiceCreateDocument", ignore = { NullPointerException.class,
ArrayIndexOutOfBoundsException.class })
public String createDocument(String name, DocumentType docType, List<SourceData> sourceDatas) {
ClientConfig clientConfig = new ClientConfig().register(MultiPartFeature.class)
.register(ClientTransactionIdFilter.class)
.property(ClientProperties.READ_TIMEOUT, "30000")
.property(ClientProperties.CONNECT_TIMEOUT, "30000")
.property(ClientProperties.PROXY_URI, properties.getProxyUrl);
Client client = ClientBuilder.newClient(clientConfig);
Builder builder = resourceTarget.request().header("Authorization", ***);
List<Cookie> iamCookies = ***
Response response = null;
try {
response = builder.post(body);
} catch (Exception e){
if(response != null) {
logger.info("Response code : " + response.getStatus());
logger.info("Response : " + response.toString());
}
e.printStackTrace();
throw new RuntimeException(e);
}
String docLocation = response.getLocation().toString();
logger.debug("Created Document Service document with location=" + docLocation);
return docLocation;
}