For example, it will render the image if the response is an image file, or open a PDF reader program if the response is a PDF document, etc.
By default, the browser handles the response based on the content type set in HTTP headers.In this case, it is recommended to forcedly set the MIME type to be binary type: The method getMimeType() returns null if there is no MIME mapping for the specified file.For example, Tomcat declares MIME mapping under section “Default MIME Types Mapping” in this file: The mapping of MIME types is declared by the servlet container.Close both the FileInputStream and OutputStream.Repeat until no bytes available to read (end of file).