You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Kam Lung Leung <kl...@wlwa.com> on 2004/04/01 23:16:02 UTC
Can Tomcat servers files outside the webapps directory
Hi,
I am working on a project that needs to retrieve audio files under the root
directory of a server (/audio). My question is that Can Tomcat 4.x servers files
that are not in the webapps directory. If it can, can someone point me to an
example of such set up. Here is an example of how the audio file may be
requested from a servlet using http.
http://hostName:portNumber/myApp/Hi.wav
Tomcat should fetch the audio file Hi.wav from the /audio directory and not from
the myApp that is under the webapps directory.
Thank you in advance,
Kam
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: Can Tomcat servers files outside the webapps directory
Posted by Emerson Cargnin <em...@tre-sc.gov.br>.
I think you have to do the inverted way as described in the thread Re:
"redirecting uploaded files in tomcat5", by TomK, you have to accept the
http request, read from an InputStream and write to an OutputStream...
Just suggest to use Buffered streams, as it will help in the performance.
BufferedInputStream bf=new BufferedInputStream(new
FileInputStream("/file_or_dir"));
The rest of the code remaisn the same...
[]s
Emerson
Kam Lung Leung wrote:
> Hi,
>
> I am working on a project that needs to retrieve audio files under the root
> directory of a server (/audio). My question is that Can Tomcat 4.x servers files
> that are not in the webapps directory. If it can, can someone point me to an
> example of such set up. Here is an example of how the audio file may be
> requested from a servlet using http.
> http://hostName:portNumber/myApp/Hi.wav
> Tomcat should fetch the audio file Hi.wav from the /audio directory and not from
> the myApp that is under the webapps directory.
>
> Thank you in advance,
> Kam
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>
--
Emerson Cargnin
Analista de Sistemas
Setor de Desenvolvimento de Sistemas - TRE-SC
tel : (048) - 251-3700 - Ramal 3181
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org