You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Georges Boutros <GB...@interstarinc.com> on 2001/02/14 20:46:16 UTC

Servlet error

hi 
i'm trying to send a picture to the browser but i keep getting this error 

public class GetTiff extends HttpServlet 
	{
	protected void doGet(HttpServletRequest req, HttpServletResponse
res)
				throws ServletException,IOException 
		{
		res.setContentType("image/jpeg"); // image/jpeg

		OutputStream out=res.getOutputStream();

		FileInputStream file=new FileInputStream("d:/matrix.jpg");
		int databyte;
		while((databyte=file.read())>=0)
			{  out.write(databyte); }
		}
	}

here's the error:
java.lang.IllegalStateException: Writer is already being used for this
request 

does anyone have a clue how can i fix this problem

thanks for any advice