dcabrero / altransdb.com (Daniel Cabrero) writes:

> Hi all,
> 
> I would want to know if it's possible to serve graphics (statistical
> graphics, for example), building SVG's and rendering them in order to
> obtain a JPEG when a query is performed.

        Yes, it is possible.
> 
> I suppose that there are java tools that can be used for rendering the
> SVG when a JSP query is performed, (you know... free if possible ;-)
> 
> It's important that the rendering happends ALWAYS ON THE SERVER, WITH
> NO PLUGINS ON THE CLIENT.

        So, you're taliking about web browsers? If so, then this might
        help:

        In the place of your generated JPG image call for example,
        JpegGeneratingServlet, like this:



        And your JpegGeneratingServlet should set the correct
        content-type:

public void doGet(...) throws ... {

        response.setContentType("image/jpg"); // or whatever
        OutputStream out = response.getOutputStream(); // not getWriter() !

        // generate the image
        svg2jpg.convert(out);  // convert your SVG to JPG and send it
                               // to servlet's output stream
        out.close();        


        Be sure not to use PrintWriter but ServletOutputStream to
        get raw data output (without character encoding).

        Of course, you might try different buffering methods.
-- 
Davor Cengija
dcengija / inet.hr
==================================
Please allow 30 days for delivery.