33import java .io .UnsupportedEncodingException ;
44import java .net .URI ;
55import java .net .URLDecoder ;
6- import java .util .Map ;
76import java .util .HashMap ;
7+ import java .util .Map ;
88
99import com .cloudinary .utils .ObjectUtils ;
1010import com .cloudinary .utils .StringUtils ;
@@ -34,10 +34,11 @@ public class Configuration {
3434 public String proxyHost ;
3535 public int proxyPort ;
3636 public Map <String , Object > properties = new HashMap <String , Object >();
37+ public Boolean secureCdnSubdomain ;
3738 public Configuration (){
3839 }
3940
40- private Configuration (String cloudName , String apiKey , String apiSecret , String secureDistribution , String cname , String uploadPrefix , boolean secure , boolean privateCdn , boolean cdnSubdomain , boolean shorten , String callback ,String proxyHost ,int proxyPort ) {
41+ private Configuration (String cloudName , String apiKey , String apiSecret , String secureDistribution , String cname , String uploadPrefix , boolean secure , boolean privateCdn , boolean cdnSubdomain , boolean shorten , String callback ,String proxyHost ,int proxyPort , Boolean secureCdnSubdomain ) {
4142 this .cloudName = cloudName ;
4243 this .apiKey = apiKey ;
4344 this .apiSecret = apiSecret ;
@@ -51,6 +52,7 @@ private Configuration(String cloudName, String apiKey, String apiSecret, String
5152 this .callback = callback ;
5253 this .proxyHost = proxyHost ;
5354 this .proxyPort = proxyPort ;
55+ this .secureCdnSubdomain = secureCdnSubdomain ;
5456 }
5557
5658
@@ -74,6 +76,7 @@ public void update(Map config) {
7476 this .callback = (String ) config .get ("callback" );
7577 this .proxyHost = (String ) config .get ("proxy_host" );
7678 this .proxyPort = ObjectUtils .asInteger (config .get ("proxy_port" ),0 );
79+ this .secureCdnSubdomain = ObjectUtils .asBoolean (config .get ("secure_cdn_subdomain" ), null );
7780 }
7881
7982
@@ -90,6 +93,9 @@ public Configuration(Configuration other) {
9093 this .cdnSubdomain = other .cdnSubdomain ;
9194 this .shorten = other .shorten ;
9295 this .callback = other .callback ;
96+ this .proxyHost = other .proxyHost ;
97+ this .proxyPort = other .proxyPort ;
98+ this .secureCdnSubdomain = other .secureCdnSubdomain ;
9399 }
94100
95101
@@ -176,11 +182,13 @@ public static class Builder {
176182 private String callback ;
177183 private String proxyHost ;
178184 private int proxyPort ;
185+ private Boolean secureCdnSubdomain ;
186+
179187
180188 /**
181189 * Creates a {@link Configuration} with the arguments supplied to this builder
182190 */
183- public Configuration build () { return new Configuration (cloudName , apiKey , apiSecret , secureDistribution , cname , uploadPrefix , secure , privateCdn , cdnSubdomain , shorten ,callback ,proxyHost ,proxyPort ); }
191+ public Configuration build () { return new Configuration (cloudName , apiKey , apiSecret , secureDistribution , cname , uploadPrefix , secure , privateCdn , cdnSubdomain , shorten ,callback ,proxyHost ,proxyPort , secureCdnSubdomain ); }
184192
185193 /**
186194 * The unique name of your cloud at Cloudinary
@@ -243,6 +251,12 @@ public Builder setPrivateCdn(boolean privateCdn) {
243251 return this ;
244252 }
245253
254+ public Builder setSecureCdnSubdomain (Boolean secureCdnSubdomain ) {
255+ this .secureCdnSubdomain = secureCdnSubdomain ;
256+ return this ;
257+ }
258+
259+
246260 /**
247261 * Whether to automatically build URLs with multiple CDN sub-domains.
248262 */
@@ -265,7 +279,7 @@ public Builder setUploadPrefix(String uploadPrefix) {
265279 this .uploadPrefix = uploadPrefix ;
266280 return this ;
267281 }
268-
282+
269283 /**
270284 * Initialize builder from existing {@link Configuration}
271285 * @param other
@@ -283,7 +297,9 @@ public Builder from(Configuration other) {
283297 this .cdnSubdomain = other .cdnSubdomain ;
284298 this .shorten = other .shorten ;
285299 this .callback = other .callback ;
286-
300+ this .proxyHost = other .proxyHost ;
301+ this .proxyPort = other .proxyPort ;
302+ this .secureCdnSubdomain = other .secureCdnSubdomain ;
287303 return this ;
288304 }
289305
0 commit comments