You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Andy Pahne <ap...@der-die-das.org> on 2004/10/12 23:55:20 UTC

Serving Images not inside the web context nor classpath

I try to include some jpg images that are located outside the 
application context and outside the classpath, but they are stored 
locally on the harddisk of the servlet container. How can I include this 
images in my Tapestry pages.

Copying those images into the context or classpath is not an option. It 
would be the easiest, if I had a component that accepts the path and 
filename as parameter and then automaticly rendered the result.

Andy

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


Re: Serving Images not inside the web context nor classpath

Posted by Mikaƫl Cluseau <nw...@nwrk.dyndns.org>.
public IAsset getImage() {
    return new ExternalAsset("/appdata/img/12.jpg");
}

Assuming /var/appdata is accessed via "/appdata" in your web container.

Andy Pahne wrote:

> A little code snippet like this would help me, I think. I do not know 
> how to fill out the blanks:
>
> public IAssest getImage(){
>      ???
>      File file = new File ("/var/appdata/img/12.jpg");
>      ???
>
> }

> Andy Pahne wrote:
>
>>
>> I try to include some jpg images that are located outside the 
>> application context and outside the classpath, but they are stored 
>> locally on the harddisk of the servlet container. How can I include 
>> this images in my Tapestry pages.
>>
>> Copying those images into the context or classpath is not an option. 
>> It would be the easiest, if I had a component that accepts the path 
>> and filename as parameter and then automaticly rendered the result.
>>
>> Andy
>>
>> ---------------------------------------------------------------------
>> 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
>


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


Re: Serving Images not inside the web context nor classpath

Posted by abangkis <ab...@sadikungroup.com>.
i've got some advice from paul ferraro.

using the custom service to fetch the image from the path you specify.
like the jchart service in the workbench example.
but i havent succed in implementing it, and havent got the time to try 
it again,
but maybe that can help you

Abangkis

Andy Pahne wrote:

>
>
>
> A little code snippet like this would help me, I think. I do not know 
> how to fill out the blanks:
>
>
> public IAssest getImage(){
>      ???
>      File file = new File ("/var/appdata/img/12.jpg");
>      ???
>
> }
>
>
>
>
>
>
> Andy Pahne wrote:
>
>>
>> I try to include some jpg images that are located outside the 
>> application context and outside the classpath, but they are stored 
>> locally on the harddisk of the servlet container. How can I include 
>> this images in my Tapestry pages.
>>
>> Copying those images into the context or classpath is not an option. 
>> It would be the easiest, if I had a component that accepts the path 
>> and filename as parameter and then automaticly rendered the result.
>>
>> Andy
>>
>> ---------------------------------------------------------------------
>> 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
>
>


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


Re: Serving Images not inside the web context nor classpath

Posted by Jonny Wray <jo...@yahoo.com>.
If you want to do it that way I'd look at the code for the various
IAsset implementations under the Tapestry code, and implement the
interface following those examples. I've done this for dynamic svg
images, excel files and pdf files and it wasn't hard. Since these are
just images of existing mime types you can use the existing  asset
service.

I solved this problem another way. I created a seperate web-app called
filesystem. Under this I had a logical directory structure classifying
my assets and then symbolic links pointing to their actual place on the
file system. Then I accessed them as full urls
(http://<machine>/filesystem/image.jgp for example). I found this
solution much more flexible in that I could uncouple the application
from the file system location using the symbolic links.

--- Andy Pahne <ap...@der-die-das.org> wrote:

> 
> 
> 
> A little code snippet like this would help me, I think. I do not know
> 
> how to fill out the blanks:
> 
> 
> public IAssest getImage(){
>       ???
>       File file = new File ("/var/appdata/img/12.jpg");
>       ???
> 
> }
> 
> 
> 
> 
> 
> 
> Andy Pahne wrote:
> > 
> > I try to include some jpg images that are located outside the 
> > application context and outside the classpath, but they are stored 
> > locally on the harddisk of the servlet container. How can I include
> this 
> > images in my Tapestry pages.
> > 
> > Copying those images into the context or classpath is not an
> option. It 
> > would be the easiest, if I had a component that accepts the path
> and 
> > filename as parameter and then automaticly rendered the result.
> > 
> > Andy
> > 
> >
> ---------------------------------------------------------------------
> > 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
> 
> 


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


Re: Serving Images not inside the web context nor classpath

Posted by Andy Pahne <ap...@der-die-das.org>.


A little code snippet like this would help me, I think. I do not know 
how to fill out the blanks:


public IAssest getImage(){
      ???
      File file = new File ("/var/appdata/img/12.jpg");
      ???

}






Andy Pahne wrote:
> 
> I try to include some jpg images that are located outside the 
> application context and outside the classpath, but they are stored 
> locally on the harddisk of the servlet container. How can I include this 
> images in my Tapestry pages.
> 
> Copying those images into the context or classpath is not an option. It 
> would be the easiest, if I had a component that accepts the path and 
> filename as parameter and then automaticly rendered the result.
> 
> Andy
> 
> ---------------------------------------------------------------------
> 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