1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.syncope.client.lib.batch;
20
21 import java.io.ByteArrayOutputStream;
22 import java.io.IOException;
23 import java.io.OutputStream;
24 import org.apache.cxf.Bus;
25 import org.apache.cxf.configuration.security.ProxyAuthorizationPolicy;
26 import org.apache.cxf.message.Message;
27 import org.apache.cxf.service.model.EndpointInfo;
28 import org.apache.cxf.transport.http.Address;
29 import org.apache.cxf.transport.http.HTTPConduit;
30 import org.apache.cxf.transport.http.auth.DefaultBasicAuthSupplier;
31 import org.apache.cxf.transports.http.configuration.HTTPClientPolicy;
32 import org.apache.cxf.ws.addressing.EndpointReferenceType;
33
34 public class BatchOfflineHTTPConduit extends HTTPConduit {
35
36 private ByteArrayOutputStream baos;
37
38 public BatchOfflineHTTPConduit(final Bus bus, final EndpointInfo ei) throws IOException {
39 this(bus, ei, null);
40 }
41
42 public BatchOfflineHTTPConduit(
43 final Bus bus,
44 final EndpointInfo ei,
45 final EndpointReferenceType t) throws IOException {
46
47 super(bus, ei, t);
48 this.proxyAuthSupplier = new DefaultBasicAuthSupplier();
49 this.proxyAuthorizationPolicy = new ProxyAuthorizationPolicy();
50 }
51
52 @Override
53 protected void setupConnection(
54 final Message message, final Address address,
55 final HTTPClientPolicy csPolicy) throws IOException {
56 }
57
58 @Override
59 public HTTPClientPolicy getClient(final Message message) {
60 return new HTTPClientPolicy();
61 }
62
63 @Override
64 protected OutputStream createOutputStream(
65 final Message message,
66 final boolean needToCacheRequest,
67 final boolean isChunking,
68 final int chunkThreshold) throws IOException {
69
70 baos = new ByteArrayOutputStream();
71 return baos;
72 }
73
74 public ByteArrayOutputStream getOutputStream() {
75 return baos;
76 }
77 }