Reputation: 9655
I am handling HTTP header 'Content-Language' for multi languages. I have 2 ways:
WAY1:
// setHeader
response.setHeader("Content-Language", "en, fr"); // Using ',' as seperator
WAY2:
// addHeader ----- Not setHeader
response.addHeader("Content-Language", "en");
response.addHeader("Content-Language", "fr");
My question is: Are these two ways equivalent? Which one should be used?
Thank you!
Upvotes: 4
Views: 2749
Reputation: 33010
You can use both variants. In both cases a response header Content-Language: en, fr
will be sent.
Calling response.addHeader
multiple times for the same header name produces a concatenated version of the header values separated by a ", "
.
Upvotes: 8