A servlet needs to send a file to the client with a specific filename. Which response header should be set and by which method?
- Cache-Control, setHeader()
- Content-Disposition, setHeader()
- Content-Type, setContentType()
- Location, sendRedirect()
To send a file with a specific filename, the Content-Disposition header should be set using the setHeader() method in the HttpServletResponse.
Loading...
Related Quiz
- How can you securely send sensitive data from a client to a server in a web application?
- The _________ pattern in caching involves generating and storing the results of a request before it's actually made.
- Which of these is not a type of memory area in the Java Virtual Machine (JVM)?
- When optimizing memory usage in a Java application, what strategies should be considered?
- How does a filter pass the request and response to the next entity in the filter chain?