Why even bother with using the Image component if you want to have custom URLs? Try this instead:

    <img jwcid="@Any" src="ognl:imageUrl"/>

where your page or component has a getImageUrl that provides the desired servlet path.

    Erik


On May 26, 2005, at 3:48 AM, Jacob Lauem�ller wrote:

Hi all,

I'm currently using Tapestry to develop an application where I need to display dynamically created charts of statistical data. I'm generating these graphs using JFreeChart and my solution is to have a Tapestry page insert an Image component and then bind this component to a ContextAsset which points to a
servlet that actually generates the bitmap.

The servlet needs to receive a few parameters defining the appearance of the chart and I'm trying to accomplish this by building a URL to the servlet such
as

/chart? type=WaitingTime&start=2005.05.10_00:00:00&end=2005.05.25_00:00:00&gra nularity=AllDataPoints

and then using this as the path for the ContextResourceLocation passed to the
ContextAsset.

The problem is that when Tapestry renders the Image component, and thus creates the <img src="xxx" ...> HTML tag, it ends up passing the src URL to AbstractMarkupWriter.attribute(String name, String value) which uses the
safePrint() method to actually output the URL.

safePrint() replaces all characters for which HTML entities exists,
transforming the URL above to

/chart? type=WaitingTime&amp;start=2005.05.10_00:00:00&amp;end=2005.05.25_00:0 0:00&amp;granularity=AllDataPoints

which obviously don't work -- the Servlet container (Tomcat 5.5.9 in this case) doesn't reverse this transformation and -- in any case -- it seems
wrong to me to encode HTTP URLs using HTML entities.

I have tried to work around this issue by replacing the & characters in the
context URL with their hex equivalents, e.g. to use

/chart?type=WaitingTime%26start=2005.05.10_00:00:00% 26end=2005.05.25_00:00:00%26granularity=AllDataPoints

in which case Tapestry no longer performs any conversions. Unfortunately, Tomcat then no longer extracts Servlet parameters correctly, finding only one
parameter ('type' in the URL above).

What gives? Is this is a bug in Tapestry -- should it really render attributes known to contain URLs such as src on <img> in this way? Or am I missing
something entirely?

TIA,
Jacob

---------------------------------------------------------------------
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]

Reply via email to