output.close() ?
On 07/05/2008, Henrik Schlanbusch <[EMAIL PROTECTED]> wrote:
> Hi
>
> I have a major problem with my file service.
> It is a service that should stream files
> to the client. It works swell in firefox
> and opera, but behaves strangely in IE.
> An image may be opened ok first time (probably
> due to caching), then the second time (after
> hitting ctrl + F5)
> the image may be streamed 50% or so and then
> maybe not at all.
>
> My service is implemented very simple:
>
> public void service(IRequestCycle cycle) throws IOException {
> try {
> Object[] params = new Object[]{cycle.getParameter("resourceId")};
> String resourceId = (String) params[0];
> FileRef ref = getFileBankManager().getFileRef(resourceId);
> File sourceFile = ref.getData().getContent();
> byte[] data = FileUtils.readFileToByteArray(sourceFile);
>
> _response.setHeader("Cache-Control", "no-cache");
> _response.setHeader("Pragma", "no-cache");
> _response.setContentLength(data.length);
>
> OutputStream output = _response.getOutputStream(
> new ContentType(ref.getData().getContentType()));
> output.write(data);
> } catch (IOException e) {
>
> } catch(Throwable t) {
> _response.setStatus(HttpServletResponse.SC_NOT_FOUND);
> t.printStackTrace();
> }
>
> return;
>
> The exception that appears is
> Connection reset by peer: socket write error
>
> I simply cannot figure out why this happens and hope that
> some of you can shed some light on this for me.
>
> Regards,
> Henrik
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
--
Marcus Schulte
http://marcus-schulte.blogspot.com
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]