Reputation: 2165
some of my users are using old browsers that do not support the Cache-Control HTTP headers. Thus, I would like to set the Expires headers in addition to make sure my content is being cached when possible.
I am using the Java SDK and I found this question that says to use the setHeader method in the ObjectMetadata when uploading.
This seems to work OK, but I notice that in the JavaDocs it states that the setHeader method is for internal use only. Are there any problems that may arise from calling this method from my own code?
Upvotes: 0
Views: 839
Reputation: 64741
This seems to work OK, but I notice that in the JavaDocs it states that the setHeader method is for internal use only. Are there any problems that may arise from calling this method from my own code?
This somewhat surprising issue turned up back then again already, see bkirkbri's comment - here's my reply:
Hmmh, I wasn't aware of that restriction indeed, but recall having used Expires: at some point a while back; I might be wrong though, insofar I often use other SDKs for interacting with S3 (e.g. C#/Python, which do definitely support this) and could have mixed that up - the code itself doesn't differ from the other setXYZHeader() methods currently (see ObjectMetadata.java), so the restriction would be based on a non visible side effect, if any.
This still seems to hold true, i.e. if you analyse the code there is nothing that would indicate otherwise - accordingly, bkirkbri's conclusion seems to properly summarize the state of affairs:
It's probably used by the other header methods internally and internal only because only certain headers will work. They should add a setExpires method on ObjectMetadata as it's the only header that doesn't have it's own method
Other than that, I'm afraid only the AWS SDK for Java team itself can provide a definite answer: As usual you might ask in the respective AWS forum, but as of recently they are accepting issues in their moved GitHub repository as well, which will likely provide a faster and more definite result for code related questions like this.
Upvotes: 1