@@ -38,6 +38,7 @@ public class Configuration {
3838 public boolean useRootPath ;
3939 public int timeout ;
4040 public boolean loadStrategies = true ;
41+ public boolean clientHints = false ;
4142
4243 public Configuration () {
4344 }
@@ -90,8 +91,34 @@ public void update(Map config) {
9091 this .useRootPath = ObjectUtils .asBoolean (config .get ("use_root_path" ), false );
9192 this .loadStrategies = ObjectUtils .asBoolean (config .get ("load_strategies" ), true );
9293 this .timeout = ObjectUtils .asInteger (config .get ("timeout" ), 0 );
94+ this .clientHints = ObjectUtils .asBoolean (config .get ("client_hints" ), false );
9395 }
9496
97+ @ SuppressWarnings ("rawtypes" )
98+ public Map <String , Object > asMap () {
99+ Map <String , Object > map = new HashMap <String , Object >();
100+ map .put ("cloud_name" , cloudName );
101+ map .put ("api_key" , apiKey );
102+ map .put ("api_secret" , apiSecret );
103+ map .put ("secure_distribution" , secureDistribution );
104+ map .put ("cname" , cname );
105+ map .put ("secure" , secure );
106+ map .put ("private_cdn" , privateCdn );
107+ map .put ("cdn_subdomain" , cdnSubdomain );
108+ map .put ("shorten" , shorten );
109+ map .put ("upload_prefix" , uploadPrefix );
110+ map .put ("callback" , callback );
111+ map .put ("proxy_host" , proxyHost );
112+ map .put ("proxy_port" , proxyPort );
113+ map .put ("secure_cdn_subdomain" , secureCdnSubdomain );
114+ map .put ("use_root_path" , useRootPath );
115+ map .put ("load_strategies" , loadStrategies );
116+ map .put ("timeout" , timeout );
117+ map .put ("client_hints" , clientHints );
118+ return map ;
119+ }
120+
121+
95122 public Configuration (Configuration other ) {
96123 this .cloudName = other .cloudName ;
97124 this .apiKey = other .apiKey ;
@@ -109,6 +136,7 @@ public Configuration(Configuration other) {
109136 this .secureCdnSubdomain = other .secureCdnSubdomain ;
110137 this .useRootPath = other .useRootPath ;
111138 this .timeout = other .timeout ;
139+ this .clientHints = other .clientHints ;
112140 }
113141
114142 /**
@@ -198,6 +226,7 @@ public static class Builder {
198226 private boolean useRootPath ;
199227 private boolean loadStrategies = true ;
200228 private int timeout ;
229+ private boolean clientHints = false ;
201230
202231 /**
203232 * Set the HTTP connection timeout.
@@ -214,7 +243,9 @@ public Builder setTimeout(int timeout) {
214243 * Creates a {@link Configuration} with the arguments supplied to this builder
215244 */
216245 public Configuration build () {
217- return new Configuration (cloudName , apiKey , apiSecret , secureDistribution , cname , uploadPrefix , secure , privateCdn , cdnSubdomain , shorten , callback , proxyHost , proxyPort , secureCdnSubdomain , useRootPath , timeout , loadStrategies );
246+ final Configuration configuration = new Configuration (cloudName , apiKey , apiSecret , secureDistribution , cname , uploadPrefix , secure , privateCdn , cdnSubdomain , shorten , callback , proxyHost , proxyPort , secureCdnSubdomain , useRootPath , timeout , loadStrategies );
247+ configuration .clientHints = clientHints ;
248+ return configuration ;
218249 }
219250
220251 /**
@@ -317,6 +348,11 @@ public Builder setLoadStrategies(boolean loadStrategies) {
317348 return this ;
318349 }
319350
351+ public Builder setClientHints (boolean clientHints ) {
352+ this .clientHints = clientHints ;
353+ return this ;
354+ }
355+
320356 /**
321357 * Initialize builder from existing {@link Configuration}
322358 *
@@ -341,6 +377,7 @@ public Builder from(Configuration other) {
341377 this .useRootPath = other .useRootPath ;
342378 this .loadStrategies = other .loadStrategies ;
343379 this .timeout = other .timeout ;
380+ this .clientHints = other .clientHints ;
344381 return this ;
345382 }
346383 }
0 commit comments