On Sat, May 3, 2008 at 2:40 PM, Toby Hobson <[EMAIL PROTECTED]> wrote:
>
> Thanks Massimo,
>
> Could you give me an example of how to return a link to an event handler
> from an expansion, or point me to some docs for this?
>
> Toby
>
On your teamplate you got something like...
<img src="${mostVotedImageUrl}" />
Then on your class file you got...
public Link getMostVotedImageUrl()
{
return _resources.createActionLink("image", false, _elementIndex);
}
Where _resources is actually a ComponentResources instance which
creates a link aware of context and all info related to the pages
where it will show up.
Then from the "image" event handler method...
public StreamResponse onImage(final Integer id)
{
return new StreamResponse()
{
public String getContentType()
{
return "image";
}
public InputStream getStream() throws IOException
{
InputStream is = null;
// retreive the stream and return it...
return is;
}
public void prepareResponse(Response response)
{
// Here is where you can put your needed infortation
for caching and other pourpose
// into the response header
}
};
}
Then the the job is done...
--
Massimo
http://meridio.blogspot.com
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]