我试图安装一个代理在我的Java代码中使用Jersey客户端,但是代理是没有得到设置。 我通过泽西文档去,并在描述方式实现的代码。 我是新来泽西所以不知道我要去哪里错了。
下面是代码。
@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;
}