This week's giveaway is in the Java/Jakarta EE forum.
We're giving away four copies of Java EE 8 High Performance and have Romain Manni-Bucau on-line!
I still don't see what value I should use with setContentLength() however.
Ranch Hand
Posts: 278
Eclipse IDE Java PHP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It automatically sets the Content-Length header to whatever the size of your output is. You don't have to manully set it as far as I know.

I was going to say that you can set the encoding with PrintWriter...but you can only do this in the constructor, which you obviously never call, since you get the PrintWriter by calling getWriter().

EDIT: Also, you don't need to call flush() flushes the response automatically.
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!