You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by sa...@women-at-work.org on 2004/11/20 11:49:30 UTC

Dynamic binding of Image/iAsset/ExternalAsset

It is me again...sorry!

All my images are on a different webserver due to load balancing.
Therefore i need to use ExternalAsset as the ANY component always puts and
end </img> tag at the end of <img>.

In the components java file that will return an IAsset i have:

mycomponent.java

public IAsset headingImage (){
		return new ExternalAsset("images/login.gif",null);
            // as a test..later it will ask a database 
            // the next problem would also to pass an additional 
            // parameter for the method that will ask the database

	}


mycomponent.jwc

<component-specification ....mycomponent.java

mycomponent.html

<span jwcid="heading"/> 
...


within mycomponent.jwc

neither:

 <component id="heading" type="Image"> 
  <binding name="image" expression="headingImage/>
 </component>

nor:
 <component id="heading" type="Image"> 
  <binding name="image" expression="ognl:headingImage/>
 </component>


nor:
 <component id="heading" type="Image"> 
  <binding name="image" expression="ognl:getHeadingImage()/>
 </component>


works....

although I put the new java class that extends BaseComponent within the
component specification.

I can not find any documentation of binding ExternalAssets/Images,


I need to use the java class to decide which Image to return as it will ask
a database...it would be to many files to list as context-assets.

Apart from that I fear that context-assets would degrade performance as they
would open the images as files ?


Thanks!

Sarah...

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: Dynamic binding of Image/iAsset/ExternalAsset

Posted by sa...@women-at-work.org.
Thanks!

i only store image urls in the database. i dont want to open any files at
all, just show them. a dedicated server for static images, tuned for
performance for static images will be more performant and faster than doing
it on the same server as dynamic content needs different tuning
than static content. There are also better servers than apache for static
content.

Sarah

> 
> On 20/11/2004, at 9:49 PM, sarah.simbad@women-at-work.org wrote:
> 
> > It is me again...sorry!
> >
> > All my images are on a different webserver due to load balancing.
> > Therefore i need to use ExternalAsset as the ANY component always puts 
> > and
> > end </img> tag at the end of <img>.
> >
> > In the components java file that will return an IAsset i have:
> >
> > mycomponent.java
> >
> > public IAsset headingImage (){
> 
> Here lies the problem. It should be getHeadingImage() ... corresponding 
> to the getImageAsset() method of the ExternalAsset example in the Image 
> entry of the Tapestry component reference. The binding is then just 
> "headingImage".
> 
> Re how to handle the images, if there are a lot of them and/or they are 
> constantly changing then you probably don't want to put them in the 
> application context or in its classpath (ContextAsset). Instead, store 
> them directly in the database (if small) or store them as ordinary 
> files (with pathnames indexed in a db, potentially), and write a new 
> service and asset class to serve them ... see the Chart service of 
> Tapestry workbench app for a related example (here the image is 
> dynamically generated though). Re efficiency, either way a service is 
> going to have to open the file and stream it out to the user. It is 
> more of a convenience and security issue.
> 
> good luck
> 
> Russell
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: Dynamic binding of Image/iAsset/ExternalAsset

Posted by Russell Edwards <Ru...@csiro.au>.
On 20/11/2004, at 9:49 PM, sarah.simbad@women-at-work.org wrote:

> It is me again...sorry!
>
> All my images are on a different webserver due to load balancing.
> Therefore i need to use ExternalAsset as the ANY component always puts 
> and
> end </img> tag at the end of <img>.
>
> In the components java file that will return an IAsset i have:
>
> mycomponent.java
>
> public IAsset headingImage (){

Here lies the problem. It should be getHeadingImage() ... corresponding 
to the getImageAsset() method of the ExternalAsset example in the Image 
entry of the Tapestry component reference. The binding is then just 
"headingImage".

Re how to handle the images, if there are a lot of them and/or they are 
constantly changing then you probably don't want to put them in the 
application context or in its classpath (ContextAsset). Instead, store 
them directly in the database (if small) or store them as ordinary 
files (with pathnames indexed in a db, potentially), and write a new 
service and asset class to serve them ... see the Chart service of 
Tapestry workbench app for a related example (here the image is 
dynamically generated though). Re efficiency, either way a service is 
going to have to open the file and stream it out to the user. It is 
more of a convenience and security issue.

good luck

Russell


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org