java - Why isn't the AmazonS3Client using the proxy I set? -
i'm running code:
string urlstring = rooturl + "/" + path; awscredentials mycredentials = new basicawscredentials(environmentvariables.aws_access_key, environmentvariables.aws_secret_key); clientconfiguration clientconfiguration = new clientconfiguration(); if ("true".equalsignorecase(environmentvariables.proxyset)) { logger.info("environmentvariables.proxyhost=" + environmentvariables.proxyhost); clientconfiguration.setproxydomain(environmentvariables.proxyhost); logger.info("environmentvariables.proxyport=" + environmentvariables.proxyport); clientconfiguration.setproxyport(integer.valueof(environmentvariables.proxyport)); } transfermanager tx = null; try { tx = new transfermanager(new amazons3client(mycredentials, clientconfiguration)); objectmetadata objectmetadata = new objectmetadata(); objectmetadata.setcontenttype(pathtocontenttype(path)); upload upload = tx.upload(bucketname, path, data, objectmetadata); upload.waitforuploadresult(); return new url(urlstring); } catch (interruptedexception e) { throw new illegalstateexception("interrupted when uploading image s3", e); } catch (malformedurlexception e) { throw new illegalstateexception("invalid url: " + urlstring, e); } { if (tx != null) { tx.shutdownnow(); } }
this works fine without proxy, if turn on proxy, don't think being used. here's how can tell: hit break point in if
statement , changed proxyhost "proxy.com" (a host exists) "proxy.com2" (a host not exist). ran fine if didn't turn proxy code on. expect error if using host.
how s3 client use proxy settings give it?
i'm using 1.8.4 of amazon sdk.
i changed setproxydomain
setproxyhost
, , started erroring expected.
Comments
Post a Comment