Hi David,

this is just a screen class which extends RawScreen as in my example.
Since I am taking the HttpOutputStream there and wirte to it and close
it, there is no template which has to be parsed...

I have commented my source below:

/* Extend RawScreen, so we can write directly to the Servlets
OutputStream */
public class ArchiveImage extends RawScreen
{

    /* return the Content type of this page so the browser knows what is
coming */
    protected String getContentType(RunData data)
    {
        return "image/jpeg";
    }

    protected void doOutput(RunData data) throws Exception
    {
        /* 
            Get all the necessary Data to display the screen.
            The Path to the Image (which is stored on the filesystem
rather than the db) is stored inside the db
        */
        AccountingArchive record =
AccountingArchivePeer.retrieveByPK(data.getParameters().getInt("id"));

        /* Now that we have the record open the image and get an
inputstream for it */
        FileInputStream in = new FileInputStream(Archiver.IMAGE_PATH +
"/" + record.getImagePath());

        /* Create a new ByteBuffer for Reading the Content */
        byte[] b = new byte[2048];
        
        /* Get The OutputStream for this screen */
        OutputStream out = data.getResponse().getOutputStream();
        
        /* While we can read Data into the Buffer print it on the
OutputStream of the Screen */
        while (in.read(b) > -1)
        {
            out.write(b);
        }

        /* Finally Flush the Stream */
        out.flush();
    }

}

HTH

Jürgen Hoffmann

Am Mo, den 17.05.2004 schrieb David Harris um 16:20: 
> Jürgen,
> 
> If Image.vm does not exist then what is going in the Velocity template 
> file that contains the following line?
> 
> <img src="$link.setPage("mrtg,Image.vm")" border="0"/>
> 
> Jürgen Hoffmann wrote:
> > Hi,
> > 
> > exactly. In fact it doesn't even exist.
> > 
> > Kind regards
> > 
> > Jürgen Hoffmann
> > 
> > 
> > -----Ursprüngliche Nachricht-----
> > Von: Robles, Rogelio [mailto:[EMAIL PROTECTED] 
> > Gesendet: Samstag, 15. Mai 2004 03:58
> > An: 'Turbine Users List'
> > Betreff: RE: communication between turbine servlets and JFreeChart
> > 
> > 
> > And what do you put inside Image.vm?, 
> > 
> > Should be empty if you just want to force Turbine to load and run your
> > de.byteaction.modules.screens.mrtg.Image class, right?
> > 
> > Thanks,
> > Rogelio
> > 
> > 
> >>-----Original Message-----
> >>From: Jürgen Hoffmann [mailto:[EMAIL PROTECTED] 
> >>Sent: Friday, May 14, 2004 1:11 AM
> >>To: Turbine Users List
> >>Subject: Re: communication between turbine servlets and JFreeChart
> >>
> > 
> > ...
> > 
> >><img src="$link.setPage("mrtg,Image.vm")" border="0"/>
> >>
> >>kind regards 
> >>
> >>Jürgen Hoffmann
> >>
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > 
> > 
> > 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> !EXCUBATOR:40a8caf3256991027813076!


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to