Even if it is not part of the HTTP 1.1 / RFC2616 web applications that want to force the resource to load (rather than display) in the browser, it can use the Content-Disposition header as follows:
Content-Disposition: attachment; filename=FILENAME
Even tough, it is defined only in RFC2183, and not in the HTTP 1.1 part, it works in most web browsers as needed.
So, on the client side, everything is pretty good.
However, on the server side, in my case, I have a Java webapp, and I don't know how I should set this header, especially in the following case ...
I will have a file (for example, called a "bigfile") hosted on an Amazon S3 instance (my S3 bucket should be accessible using a partial address, for example: files.mycompany.com/) so that users can access this file on files .mycompany.com / bigfile.
Now is there a way to create a servlet (or .jsp) so that the Content-Disposition header is always added when the user wants to download this file?
What would the code look like and what are it, if any?
java web-applications jsp content-disposition
SyntaxT3rr0r
source share