Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

There is a problem while calling the method  RSS feed

 
gurusamy sengodan
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I want to use the following method at the same time.
is it possible?
1)response.getWriter();
2)response.getOutputStream();

I have written two method.
In first method, i am using response.getWriter();
In the second method, i am using response.getOutputStream();
Why because, in one place i have to handle bytes
in another place i have to handle characters.
But while calling the method. i got the exception.
How to handle these things.
 
kishore kovil
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
i think we cannot use both printwriter and stream objects both at the same time
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Kishore is correct.

You can only send back one response per request and that response can not be a mixture of binary and textual data.

Maybe if you describe what you're tryning to do, someone can suggest an alternative.
 
Alex Sotin
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't know exactly why do you need 2 responses for 1 request, but I think you can put one of your responses in the http header (if you use it). Please tell us more detailed what are you doing
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!