Your requirement is to set the desired content type before sending response back to the client, so use httpServletResponse.setContentType("text/plain;charset=ISO-8859-1");
This is method from javax.servlet.ServletResponse(setContentType(java.lang.String type)
Below excerpt from doc.
Sets the content type of the response being sent to the client, if the
response has not been committed yet. The given content type may
include a character encoding specification, for example,
text/html;charset=UTF-8. The response's character encoding is only set
from the given content type if this method is called before getWriter
is called.
This method may be called repeatedly to change content type and
character encoding. This method has no effect if called after the
response has been committed. It does not set the response's character
encoding if it is called after getWriter has been called or after the
response has been committed.
Containers must communicate the content type and the character
encoding used for the servlet response's writer to the client if the
protocol provides a way for doing so. In the case of HTTP, the
Content-Type header is used.
Please note: You should use this method before you commit the response back to the client. See this from above excerpt - "This method has no effect if called after the response has been committed. It does not set the response's character encoding if it is called after getWriter has been called or after the response has been committed."
On a side note:
- To make your applicable more scalable i.e. possibility to support more languages in future, use encoding scheme as "UTF-8".
- Do read my this answer to get in-depth details on WHY?