Skip to content

Commit 8c8b384

Browse files
authored
Merge pull request #59 from yma96/master
Add proxyAllowHttpJobTypes param for SiteConfig
2 parents 2f0dcc1 + a5b4c9b commit 8c8b384

File tree

2 files changed

+34
-9
lines changed

2 files changed

+34
-9
lines changed

src/main/java/org/commonjava/util/jhttpc/model/SiteConfig.java

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ public final class SiteConfig
4040

4141
public static final int DEFAULT_CONNECTION_POOL_TIMEOUT_SECONDS = 60;
4242

43+
public static final String DEFAULT_PROXY_ALLOW_HTTP_JOB_TYPES = "download,existence,listing";
44+
4345
private final String id;
4446

4547
private final String uri;
@@ -52,6 +54,8 @@ public final class SiteConfig
5254

5355
private final String proxyUser;
5456

57+
private final String proxyAllowHttpJobTypes;
58+
5559
private final SiteTrustType trustType;
5660

5761
private final String keyCertPem;
@@ -87,18 +91,20 @@ public final class SiteConfig
8791
private final Integer baseSampleRate;
8892

8993
SiteConfig( String id, String uri, String user, String proxyHost, Integer proxyPort, String proxyUser,
90-
SiteTrustType trustType, String keyCertPem, String serverCertPem, Integer requestTimeoutSeconds,
91-
Integer connectionPoolTimeoutSeconds, Integer maxConnections, Integer maxPerRoute,
92-
final ConnectionConfig connectionConfig, final SocketConfig socketConfig,
93-
final RequestConfig requestConfig, HttpClientContext clientContextPrototype, boolean ignoreHostnameVerification, Map<String, Object> attributes,
94-
Boolean metricEnabled, String honeycombDataset, String honeycombWriteKey, Integer baseSampleRate )
94+
String proxyAllowHttpJobTypes, SiteTrustType trustType, String keyCertPem, String serverCertPem,
95+
Integer requestTimeoutSeconds, Integer connectionPoolTimeoutSeconds, Integer maxConnections,
96+
Integer maxPerRoute, final ConnectionConfig connectionConfig, final SocketConfig socketConfig,
97+
final RequestConfig requestConfig, HttpClientContext clientContextPrototype,
98+
boolean ignoreHostnameVerification, Map<String, Object> attributes, Boolean metricEnabled,
99+
String honeycombDataset, String honeycombWriteKey, Integer baseSampleRate )
95100
{
96101
this.id = id;
97102
this.uri = uri;
98103
this.user = user;
99104
this.proxyHost = proxyHost;
100105
this.proxyPort = proxyPort;
101106
this.proxyUser = proxyUser;
107+
this.proxyAllowHttpJobTypes = proxyAllowHttpJobTypes;
102108
this.trustType = trustType;
103109
this.keyCertPem = keyCertPem;
104110
this.serverCertPem = serverCertPem;
@@ -168,6 +174,11 @@ public String getProxyUser()
168174
return proxyUser;
169175
}
170176

177+
public String getProxyAllowHttpJobTypes()
178+
{
179+
return proxyAllowHttpJobTypes == null ? DEFAULT_PROXY_ALLOW_HTTP_JOB_TYPES : proxyAllowHttpJobTypes;
180+
}
181+
171182
public String getKeyCertPem()
172183
{
173184
return keyCertPem;

src/main/java/org/commonjava/util/jhttpc/model/SiteConfigBuilder.java

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ public class SiteConfigBuilder
4848

4949
private String proxyUser;
5050

51+
private String proxyAllowHttpJobTypes;
52+
5153
private SiteTrustType trustType;
5254

5355
private String keyCertPem;
@@ -99,10 +101,11 @@ public SiteConfigBuilder( String id, String uri )
99101

100102
public SiteConfig build()
101103
{
102-
return new SiteConfig( id, uri, user, proxyHost, proxyPort, proxyUser, trustType, keyCertPem, serverCertPem,
103-
requestTimeoutSeconds, connectionPoolTimeoutSeconds, maxConnections, maxPerRoute,
104-
connectionConfig, socketConfig, requestConfig, clientContextProtoype,
105-
ignoreHostnameVerification, attributes, metricEnabled, honeycombDataset, honeycombWriteKey, baseSampleRate );
104+
return new SiteConfig( id, uri, user, proxyHost, proxyPort, proxyUser, proxyAllowHttpJobTypes, trustType,
105+
keyCertPem, serverCertPem, requestTimeoutSeconds, connectionPoolTimeoutSeconds,
106+
maxConnections, maxPerRoute, connectionConfig, socketConfig, requestConfig,
107+
clientContextProtoype, ignoreHostnameVerification, attributes, metricEnabled,
108+
honeycombDataset, honeycombWriteKey, baseSampleRate );
106109
}
107110

108111
public String getId()
@@ -149,6 +152,11 @@ public String getProxyUser()
149152
return proxyUser;
150153
}
151154

155+
public String getProxyAllowHttpJobTypes()
156+
{
157+
return proxyAllowHttpJobTypes;
158+
}
159+
152160
public String getKeyCertPem()
153161
{
154162
return keyCertPem;
@@ -227,6 +235,12 @@ public SiteConfigBuilder withProxyUser( String proxyUser )
227235
return this;
228236
}
229237

238+
public SiteConfigBuilder withProxyAllowHttpJobTypes( String proxyAllowHttpJobTypes )
239+
{
240+
this.proxyAllowHttpJobTypes = proxyAllowHttpJobTypes;
241+
return this;
242+
}
243+
230244
public SiteConfigBuilder withTrustType( SiteTrustType trustType )
231245
{
232246
this.trustType = trustType;

0 commit comments

Comments
 (0)