I have a question about sending a text response from a
servlet. One way to do this would be
Now I was reading about the PrintWriter you get with response.getWriter() to send text data. I think it would look something like this:
I am not sure a) what length I would need to set for ContentLength, and b) I wonder if the Writer automatically uses the encoding I set with setCharacterEncoding(). It seems to me the method using the OutputStream is safer than the Writer, because you explicitely state the encoding you want to use, and the length of the content..