Take a look at the official documentation on the getOutputStream method:
public ServletOutputSt ream getOutputStream () throws IOException
IllegalStateExc eption - if the getWriter method has been called on this
response
IOException - if an input or output exception occurred
If the getOutputStream can throw the 'IllegalStateEx ception', shouidn't the method be defined as: public ServletOutputSt ream getOuputStream( ) throws IllegalStateExc eption, IOException ?
public ServletOutputSt ream getOutputStream () throws IOException
Returns a ServletOutputSt ream suitable for writing binary data in the
response. The servlet container does not encode the binary data.
Calling flush() on the ServletOutputSt ream commits the response. Either this
method or getWriter() may be called to write the body, not both.
Returns: a ServletOutputSt ream for writing binary data
Throws:response. The servlet container does not encode the binary data.
Calling flush() on the ServletOutputSt ream commits the response. Either this
method or getWriter() may be called to write the body, not both.
Returns: a ServletOutputSt ream for writing binary data
IllegalStateExc eption - if the getWriter method has been called on this
response
IOException - if an input or output exception occurred
If the getOutputStream can throw the 'IllegalStateEx ception', shouidn't the method be defined as: public ServletOutputSt ream getOuputStream( ) throws IllegalStateExc eption, IOException ?
Comment