tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Steffen Heil" <li...@steffen-heil.de>
Subject DefaultServlet and getOutputStream() / getWriter()
Date Sat, 09 Oct 2004 06:13:21 GMT
Hi

I am reviewing the source code of the DefaultServlet.
I do not understand the following:

// slightly modified from source of "serveResource".
      ServletOutputStream ostream = null;
      PrintWriter writer = null;
      try {
        ostream = response.getOutputStream();
      } catch (IllegalStateException e) {
         if ( contentType == null || contentType.startsWith( "text" ) )
            writer = response.getWriter();
          else
            throw e;
        }
      }

Why would getOutputStream() fail?
And if that fails, why would getWriter() succeed?

Text data is also binary data, right?
I would understand that the other way around...

Regards,
  Steffen

Mime
View raw message