getOutputStream and getWriter in servlet

J

John Smith

In a servlet you can call either getOutputStream or getWriter but only one,
calling the other later gets an IllegalStateException. Is there a way of
finding out what has already been called?

Thanks

Jon
 
H

hiwa

John Smith ã®ãƒ¡ãƒƒã‚»ãƒ¼ã‚¸:
In a servlet you can call either getOutputStream or getWriter but only one,
calling the other later gets an IllegalStateException. Is there a way of
finding out what has already been called?

Thanks

Jon
calling the other later
Just don't do it.
 
A

Andrea Desole

John said:
In a servlet you can call either getOutputStream or getWriter but only one,
calling the other later gets an IllegalStateException. Is there a way of
finding out what has already been called?

the best solution is to know what you call. There is no point in writing
binary data to a writer. I would say this is also the meaning of the
exception.

Besides that, I'm afraid the only possibility to know that a method has
been called is to catch the exception when you try to call the other one.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,052
Latest member
KetoBeez

Latest Threads

Top