This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java.lang.IllegalStateException: getWriter() has already been called for this response

 
Arun Giridharan
Ranch Hand
Posts: 290
Debian Fedora Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying to access both response.getWriter() and response.outputStream() method
My code


Exeption i'm getting

HTTP Status 500 -

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

java.lang.IllegalStateException: getWriter() has already been called for this response
org.apache.catalina.connector.Response.getOutputStream(Response.java:580)
org.apache.catalina.connector.ResponseFacade.getOutputStream(ResponseFacade.java:183)
com.example.web.CodeReturn.doGet(CodeReturn.java:21)
javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

note The full stack trace of the root cause is available in the Apache Tomcat/6.0.28 logs.

It says i can't access both ,but what if i want to access both ?!
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64708
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Arun Giridharan wrote:but what if i want to access both ?

You will be disappointed.
 
Paul Clapham
Sheriff
Pie
Posts: 20966
31
Eclipse IDE Firefox Browser MySQL Database
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Arun Giridharan wrote:It says i can't access both ,but what if i want to access both ?!


Then stop wanting to do that. Why would you want to, anyway? Either you're writing some data which isn't text (like your application which is apparently sending a jar file as the response) in which case you shouldn't be writing text. Or you're writing some data which is text, in which case you should only be writing text.
 
Arun Giridharan
Ranch Hand
Posts: 290
Debian Fedora Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul Clapham wrote:
Arun Giridharan wrote:It says i can't access both ,but what if i want to access both ?!


Then stop wanting to do that. Why would you want to, anyway? Either you're writing some data which isn't text (like your application which is apparently sending a jar file as the response) in which case you shouldn't be writing text. Or you're writing some data which is text, in which case you should only be writing text.


What if my stupid Team-Lead want me to do it !! (i mean how can i do it rather than disappointment!?)
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64708
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can't. So your stupid team leader will be disappointed.

Has he explained why he wants this?
 
Arun Giridharan
Ranch Hand
Posts: 290
Debian Fedora Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank You

Paul Clapham and Bear Bibeault
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic