开发者

JetS3t : Amazon S3 : How to dynamically change endpoints

My understanding is that before Jets3t 0.7.4 S3 endpoint was set statically at S3Service::setS3EndpointHost. So there was no way to use Jet开发者_如何学Cs3t to Get/Put content to S3 using different S3 endpoints in same application.

In Jets3t 0.7.4 release notes it's written - "Deprecated static methods in S3Service for generating signed URLs. The new non-static method equivalents should be used from now on to avoid dependency on a VM-wide S3 endpoint constant."

Is it possible now to change S3 endpoints dynamically ? If yes how to do it.. is there a setS3Endpoint method available ?


You can set it like this:

private void setS3Endpoint(final String endpoint) {
        final Jets3tProperties props = Jets3tProperties.getInstance(Constants.JETS3T_PROPERTIES_FILENAME);
        props.setProperty("s3service.s3-endpoint", endpoint);
}


There is no such method in the jets3t api. The endpoint is set in the Jets3t.properties file You could (theoretically) pull in the Jets3t.properties file and change it with a helper class in Java, then create a new s3Service object that hopefully has the new config.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜