xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jonathan wood <jonathanshaww...@gmail.com>
Subject Re: Creating an image on the fly from a servlet
Date Tue, 23 Feb 2010 19:19:33 GMT
I havent tried to duplicate using your code, but I do notice that my servlet
transcodes always set the content type before obtaining the sevlet output
stream:

        response.setContentType("image/png");


worth a try?



On Tue, Feb 23, 2010 at 2:11 PM, Jan Tosovsky <j.tosovsky@tiscali.cz> wrote:

> > > Although I can see the result in the target browser, I am unable to
> > save the
> > > image on a local disk. Actually, in Firefox I can notice an attempt
> > to save
> > > the file, but in a download manager it is of zero size and it is not
> > really
> > > present in the target location. MSIE offers me save the PNG file in
> > BMP
> > > format...
> >
> > The fact that you can see it and cannot save it very weird. Even
> > weirder is the described MSIE behavior. If you are working with the
> > trunk code, maybe your are getting bit by bug 48693 [1]? If you are
> > working with Batik 1.7, that may be bug 46863 [2].
>
> Thanks for this info. It led me to try also JPEG output, but the result is
> the same. I suspect the way of closing the final stream. I think the
> browser
> can display partial data but as they are unfinished properly, it made him
> puzzled a bit.
>
> Transcoding via command line is Ok in all cases.
>
> > Could you try to analyze the (supposedly PNG) raw file saved and/or
> > attach it to a reply?
>
> No file is created in FF so there is nothing to analyze. And that MSIE BMP
> file is the standard image. It is probably a kind of the screenshot of an
> internal canvas.
>
> Here is the final part of my code:
>
> TranscoderOutput output = new TranscoderOutput(response.getOutputStream());
> t.transcode(input, output);
>
> // I've tried to find any closing method of the 'output' object,
> // but still without success. The following way also doesn't help
> //
> // output.getWriter().close();
>
> ServletOutputStream out = response.getOutputStream();
> out.flush();
> out.close();
>
> Any other ideas?
>
> Jan
>
> > Hope this helps,
> >  Helder
> >
> >
> > [1] https://issues.apache.org/bugzilla/show_bug.cgi?id=48693
> > [2] https://issues.apache.org/bugzilla/show_bug.cgi?id=46863
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
>
>

Mime
View raw message