Monday, 2 July 2012

What is the difference between HttpServletResponse methods setHeader(), addHeader() and setIntHeader()?

void setHeader(String name, String value)
If a header with this name already in response, then that header value is replaced with this value. Otherwise adds a new header and value to the response.

void addHeader(String name, String value)
If a header with this name already in response, then adds an additional value to the existing header. Otherwise adds a new header and value to the response.

void setIntHeader(String name, int value)
If a integer type header with this name already in response, then replaces that header value with this new integer value. Otherwise adds a new header and value in response.

No comments:

Post a Comment