1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.ksb.messaging.serviceconnectors;
17
18 import org.apache.cxf.endpoint.Client;
19 import org.apache.cxf.frontend.ClientProxy;
20 import org.apache.cxf.transport.http.HTTPConduit;
21 import org.apache.cxf.transports.http.configuration.HTTPClientPolicy;
22 import org.apache.log4j.Logger;
23 import org.kuali.rice.ksb.messaging.ServiceInfo;
24 import org.kuali.rice.ksb.service.KSBServiceLocator;
25
26
27
28
29
30
31
32 public abstract class AbstractCxfClientServiceConnector extends AbstractServiceConnector {
33
34 private static final Logger LOG = Logger.getLogger(AbstractCxfClientServiceConnector.class);
35 private static final String HTTP_CLIENT_POLICY_BEAN = "httpClientPolicy";
36
37 public AbstractCxfClientServiceConnector(ServiceInfo serviceInfo) {
38 super(serviceInfo);
39 }
40
41
42
43
44
45
46 @Override
47 protected void applyClientPolicy(Object service) {
48
49 HTTPClientPolicy policy =
50 (HTTPClientPolicy)KSBServiceLocator.getService(HTTP_CLIENT_POLICY_BEAN);
51 if (policy != null) {
52 try {
53 Client cl = ClientProxy.getClient(service);
54 ((HTTPConduit)cl.getConduit()).setClient(policy);
55 } catch (Exception e) {
56 LOG.warn("unable to set HTTP client policy", e);
57 }
58 }
59
60 super.applyClientPolicy(service);
61 }
62
63 }