tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Remy Maucherat <r...@apache.org>
Subject Re: DefaultServlet and getOutputStream() / getWriter()
Date Sat, 09 Oct 2004 07:17:30 GMT
Steffen Heil wrote:

>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...
>  
>
That's definitely why I am not interested by code cleanups done by folks 
who might not know all the small tricks: the risk of breaking stuff is 
far greater than the gain.

For this particular case, you should look into the API javadocs.

Rémy


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Mime
View raw message