You can also create your own implementation of IAsset. Something like that:

public class YetAnotherAsset implements IAsset{
    private Resource resource;

    public YetAnotherAsset(Resource resource){
           this.resource=resource;
    }
    public String buildURL(){
        return resource.getPath();
    }
    public Resource getResourceLocation(){
         return this.resource;
    }
    public Resource getAsStream(){
           use IOUtils
    }
}

And put e.g
http://hivemind.apache.org/hivemind1/hivemind/apidocs/org/apache/hivemind/util/URLResource.htmlinto
the constructor

On Jan 8, 2008 6:40 PM, Andreas Andreou <[EMAIL PROTECTED]> wrote:

> oh - I think i'd go for a custom IEngineService for that...
>
> i.e. something like :
>
>    public void service(IRequestCycle cycle) throws IOException {
>        String filename = cycle.getParameter("f");
>        String realFilename = imagesFolder + filename;
>        OutputStream responseOutputStream =
> response.getOutputStream(new ContentType("image/jpeg"));
>        InputStream stream = new FileInputStream(realFilename);
>        IOUtils.copy(stream, responseOutputStream);
>    }
>
> If you want to stick with the assets approach, you'd need your own
> implementation perhaps
>
> On Jan 8, 2008 7:25 PM,  <[EMAIL PROTECTED]> wrote:
> > Then, I just need to change the path somewhere I assume.
> >
> > It is 250 Gigabytes of image data and I do not want to war them every
> time I make a change during development...on the final system they will be
> on a linux machine so I can just make virtual directories and link to the
> storage.
> >
> > So do I need to use the hivemind.xml somehow ?
> >
> > It sounds really complicated just to have images from an external
> directory
> > outside of the war file / the web root....
> >
> >
> > -------- Original-Nachricht --------
> > > Datum: Tue, 8 Jan 2008 17:52:02 +0100
> > > Von: "Igor Drobiazko" <[EMAIL PROTECTED]>
> >
> > > An: "Tapestry users" <users@tapestry.apache.org>
> > > Betreff: Re: PrivateAsset example please
> >
> > > Have a look at HiveMind API.
> > >
> http://hivemind.apache.org/hivemind1/hivemind/apidocs/org/apache/hivemind/impl/LocationImpl.html
> > >
> http://hivemind.apache.org/hivemind1/hivemind/apidocs/org/apache/hivemind/util/URLResource.html
> > >
> > > If I would be you, I would rethink the architecture. How do you want
> to
> > > access images when you go online?
> > >
> > > On Jan 8, 2008 5:37 PM, <[EMAIL PROTECTED]> wrote:
> > >
> > > > Do you have an example?
> > > >
> > > > What is the path? Relativ so the classpath?
> > > > How do I create a location object ?
> > > >
> > > > Do I need to set:
> > > >
> > > >
> > > >        <meta key="org.apache.tapestry.asset.dir"
> > > > value="file:///Z:/Media/"/>
> > > >
> > > > as well or would that expose the whole directoy to anyone?
> > > >
> > > >
> > > > I wish there was an example somewhere.....
> > > >
> > > >
> > > > -------- Original-Nachricht --------
> > > > > Datum: Tue, 8 Jan 2008 18:20:34 +0200
> > > > > Von: "Andreas Andreou" <[EMAIL PROTECTED]>
> > > > > An: "Tapestry users" <users@tapestry.apache.org>
> > > > > Betreff: Re: PrivateAsset example please
> > > >
> > > > > Hi, those Assets implementations are easier to create through the
> > > > > AssetFactory services...
> > > > >
> > > > > For instance, there's a ClasspathAssetFactory, so perhaps use its
> > > > > IAsset createAbsoluteAsset(String path, Locale locale, Location
> > > > location)
> > > > >
> > > > >
> > > >
> > >
> http://tapestry.apache.org/tapestry4.1/apidocs/org/apache/tapestry/asset/ClasspathAssetFactory.html
> > > > >
> > > > >
> > > > > On Jan 8, 2008 5:46 PM,  <[EMAIL PROTECTED]> wrote:
> > > > > > PrivateAsset takes the following parameters:
> > > > > >
> > > > > > Resource resourceLocation, IEngineService assetService, Location
> > > > > location
> > > > > >
> > > > > > The images are in another directory on a different disk....the
> > > > directory
> > > > > is on the classpath...so the image should be in:
> > > > > >
> > > > > > someimages/picture.jpg
> > > > > >
> > > > > > How do I create a resourcelocation, how do I get the
> assetService
> > > and
> > > > > how the location?
> > > > > >
> > > > > > Thanks!
> > > > > >
> > > > > >
> > > > > >
> > > > > > -------- Original-Nachricht --------
> > > > > > > Datum: Tue, 08 Jan 2008 16:24:41 +0100
> > > > > > > Von: [EMAIL PROTECTED]
> > > > > >
> > > > > > > An: "Tapestry users" <users@tapestry.apache.org>
> > > > > > > Betreff: Re: PrivateAsset example please
> > > > > >
> > > > > > > Thanks. There are no exmaples on these pages though.
> > > > > > >
> > > > > > > public IAsset getScreenshot(String name){
> > > > > > >
> > > > > > >                       return new
> > > > > ExternalAsset("thumbs/".concat(name).concat(".JPG"), null);
> > > > > > >
> > > > > > > I have tried this also:
> > > > > > >
> > > > > > > So if I used PrivateAsset what do the paramters look like?
> > > > > > >
> > > > > > > Just a short example would be cool....
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > -------- Original-Nachricht --------
> > > > > > > > Datum: Tue, 8 Jan 2008 14:36:51 +0200
> > > > > > > > Von: "Andreas Andreou" <[EMAIL PROTECTED]>
> > > > > > > > An: "Tapestry users" <users@tapestry.apache.org>
> > > > > > > > Betreff: Re: PrivateAsset example please
> > > > > > >
> > > > > > > > it's auto-used when it's a classpath asset...
> > > > > > > > see
> > > > > > > >
> > > > >
> http://tapestry.apache.org/tapestry4.1/usersguide/spec.html#spec.asset
> > > > > > > > and
> > > > > > > >
> > > > >
> http://tapestry.apache.org/tapestry4.1/tapestry-annotations/index.html
> > > > > > > > (InjectAsset)
> > > > > > > >
> > > > > > > > On Jan 8, 2008 2:02 PM,  <[EMAIL PROTECTED]> wrote:
> > > > > > > > > I wonder who this works:
> > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > >
> > > >
> > >
> http://tapestry.apache.org/tapestry4.1/tapestry-framework/apidocs/org/apache/tapestry/asset/PrivateAsset.html
> > > > > > > > >
> > > > > > > > > How do I use the PrivateAsset component?
> > > > > > > > >
> > > > > > > > >
> > > > >
> ---------------------------------------------------------------------
> > > > > > > > > To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> > > > > > > > > For additional commands, e-mail:
> > > [EMAIL PROTECTED]
> > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > > --
> > > > > > > > Andreas Andreou - [EMAIL PROTECTED] -
> http://blog.andyhot.gr
> > > > > > > > Tapestry / Tacos developer
> > > > > > > > Open Source / JEE Consulting
> > > > > > > >
> > > > > > > >
> > > > >
> ---------------------------------------------------------------------
> > > > > > > > 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]
> > > > > >
> > > > > >
> > > ---------------------------------------------------------------------
> > > > > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > > > > For additional commands, e-mail: [EMAIL PROTECTED]
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > > >
> > > > > --
> > > > > Andreas Andreou - [EMAIL PROTECTED] - http://blog.andyhot.gr
> > > > > Tapestry / Tacos developer
> > > > > Open Source / JEE Consulting
> > > > >
> > > > >
> ---------------------------------------------------------------------
> > > > > 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]
> > > >
> > > >
> > >
> > >
> > > --
> > > Best regards,
> > >
> > > Igor Drobiazko
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
>
>
> --
> Andreas Andreou - [EMAIL PROTECTED] - http://blog.andyhot.gr
> Tapestry / Tacos developer
> Open Source / JEE Consulting
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


-- 
Best regards,

Igor Drobiazko

Reply via email to