You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by David Harris <ha...@ebrinc.com> on 2004/05/19 18:21:43 UTC
Re: turbine apps and JFreeChart and Velocity
Hello Jürgen and list
Well I got around to your suggestion and I must have done something
wrong, I got no graph.... here is the Velocity template line I used and
what it expanded to
<img src="$link.setPage("Graph.vm")"/>
<img
src="http://localhost:8080/collabAdvizor/servlet/collabAdvizor/template/Graph.vm"/>
I added some code to create charts inside an existing action's doPerform
method.
My method was called but I got no graph. But I did find some indication
of something inside a 275K file called
c:/tdk-2.3/work/Standalone/localhost/collabAdvizor/SESSION.ser
There were a couple of strings in there that refered to JFreeChart.
I really don't see how I could have a graph when the template line
expands to what I got..... I know I have more investigating and learning
to do, any ideas were I should be looking?
It would be nice if I could write the graph file into a temp location
that I could construct a URL for.
Dave
Jürgen Hoffmann wrote:
> 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:Rogelio.Robles@experian.com]
>>>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:jh@byteaction.de]
>>>>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: turbine-user-unsubscribe@jakarta.apache.org
>>>For additional commands, e-mail: turbine-user-help@jakarta.apache.org
>>>
>>>
>>>
>>
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: turbine-user-help@jakarta.apache.org
>>
>>
>>!EXCUBATOR:40a8caf3256991027813076!
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org