On Thu, 6 Sep 2001, Evgeniy Strokin wrote:
> Date: Thu, 6 Sep 2001 11:43:56 -0400
> From: Evgeniy Strokin <[EMAIL PROTECTED]>
> Reply-To: [EMAIL PROTECTED]
> To: "Tomcat-User@Jakarta. Apache. Org" <[EMAIL PROTECTED]>
> Subject: How download file from servlet?
>
> HI
>
> I trying make servlet for downloading of files.
> When I use:
> FileInputStream fl=new FileInputStream(dir);
> byte b[]=new byte[4096];
> int len=0;
> ServletOutputStream souts=_response.getOutputStream();
> while(len!=-1){
> len=fl.read(b);
> if(len!=-1)souts.write(b,0,len);
> }
> I get:
> E:1933 java.lang.IllegalStateException: Writer is already being used for
> this request
> In this string:
> ServletOutputStream souts=_response.getOutputStream();
>
> Anyway, maybe you know better way how do this thing?
>
This error means that, somewhere while processing the same request, your
servlet called response.getWriter(). You can only get a writer *or* an
output stream for a particular response (depending on whether you want to
send characters or bytes). You cannot get both.
> Thanks
> Jenya
>
Craig