You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by hl...@attbi.com on 2003/01/27 19:39:33 UTC

Re: [Tapestry-developer] Externalizing Assets

You negelected to say what failed.

Tapestry isn't doing any magic.

You have to set up your servlet container to vend out the specified directory 
as the specified URL.

All Tapestry does is copy files to the directory, and create a URL for the 
copied file, based on the values you provide.

Take a look at the run-tutorial target in build.xml (in the distro).
You can see it creating the private directory, and specifying the 
configuration (the two system properties) there.

Look at config/jetty.xml; you can see in there that it defines the necessary 
stuff to vend out the files stored in the private directory.



--
hlship@attbi.com

Tapestry: Java Web Components
http;//jakarta.apache.org
> Hi everybody
> 
> Yet another question...
> I have been trying in vain to start Externalizing my assets, but no
> banana....
> 
> From what I can see in the docs, all I need to do is
> 
> In my servlet's init method
> 
> public void init(ServletConfig config) throws ServletException {
> 	Properties props = System.getProperties();
> 	props.put("net.sf.tapestry.asset.dir", "assets");
> 	props.put("net.sf.tapestry.asset.URL", "/assets");
> 	super.init(config);
> }
> 
> And the test page that I'm trying to get the Assets externalized on
> 
> 1. the JWC file
>   <component id="toggleImage" type="Image">
>   	<binding name="image" expression="toggleImageAsset"/>
>   </component>
>   .....
>   .....
>   .....
>   <private-asset name="myImageOne" resource-path="&here;/imageOne.gif"/>
>   <private-asset name="myImageTwo" resource-path="&here;/imageTwo.gif"/>
> 
> 2. the java file
>   public IAsset getToggleImage(){
>      String name = oneActive ? "myImageOne" : "myImageTwo";
>      return getAsset(name);
>   }
> 
> 
> I am using Tapestry 2.2, JBoss 3/Jetty, Sun Jdk 1.4.1
> 
> Thankyou in advance
> Ivanhoe Abrahams
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.437 / Virus Database: 245 - Release Date: 2003/01/06
> 
> 
> 
> -------------------------------------------------------
> This SF.NET email is sponsored by:
> SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
> http://www.vasoftware.com
> _______________________________________________
> Tapestry-developer mailing list
> Tapestry-developer@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/tapestry-developer