我正在使用 HttpConduit 和 HttpClientPolicy 配置 CXF。现在每个请求都会看到以下自定义:
Client client = ClientProxy.getClient(queryService);
client.getRequestContext().put(Message.ENDPOINT_ADDRESS, server);
HTTPConduit conduit = (HTTPConduit) client.getConduit();
HTTPClientPolicy policy = new HTTPClientPolicy();
policy.setConnectionTimeout(timeout * 1000);
policy.setReceiveTimeout(timeout * 1000);
if (AUTHENTICATION_TYPE_NTLM.equals(authenticationType))
policy.setAllowChunking(false);
if (authenticationCookie != null)
policy.setCookie(authenticationCookie.toString());
conduit.setClient(policy);
这些定制是否可以在queryService
创建实例时应用一次?如果是这种情况,如何为每个请求独立设置身份验证 cookie?