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
hiwa - 16 Jun 2006 10:18 GMT
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
[quoted text clipped - 3 lines]
>
> Jon
> calling the other later
Just don't do it.
Andrea Desole - 16 Jun 2006 10:29 GMT
> 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.