If you need to set a custom header in an HTTP response, which HttpServletResponse method should you use?
- addHeader(String name, String value)
- appendHeader(String name, String value)
- setHeader(String name, String value)
- writeHeader(String name, String value)
To set a custom header in an HTTP response, you should use the setHeader(String name, String value) method of the HttpServletResponse interface.
Loading...
Related Quiz
- What is the significance of the web.xml security constraints in servlet security?
- The method __________ is used to set the length of the content body in the response.
- The process of replacing older cache entries with new ones is known as __________.
- The __________ method is used by an HTTP servlet to handle PUT requests.
- When using RequestDispatcher's forward method, changes to the response _________ affect the final output.