aspose file tools*
The moose likes Servlets and the fly likes ByteArrayOutputStream Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "ByteArrayOutputStream" Watch "ByteArrayOutputStream" New topic
Author

ByteArrayOutputStream

Bob Moranski
Ranch Hand

Joined: Nov 22, 2000
Posts: 177
When we have a servlet that does persistent connection, why do we have to have aByteArrayOutput.writeTo(res.getOutputStream()) even after we already sent out the required info through res.getWriter().println(info)?
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12682
    
    5
You appear to be doing a res.getOutputStream() after you already did a res.getWriter().
By my understanding of the API, that should cause a IllegalStateException to be thrown.
Why do you think "why do we have to"?
What is telling you that you have to do that?
Bill

------------------
author of:


Java Resources at www.wbrogden.com
Bob Moranski
Ranch Hand

Joined: Nov 22, 2000
Posts: 177
Hi, I am so sorry. It was not res.getWriter() but a PrintWriter(new ByteArrayOutputStream(1024), true).
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: ByteArrayOutputStream
 
Similar Threads
PASSED Beta!!! The wait is over!
path info vs query string...
illegalstateexception i am getting
Weblogic 9.0 Server admin exam, WHEN ?
jdbc