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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]