You can do this way, but a context just for containing the audio files is a kind of weird. Other approach is to have a symbolic link from your context to the audio directory...

Kam Lung Leung wrote:
Hi Emerson,

Thank you for your help. But I don't understand why I do I have to write Java
code to transmit the file. Shouldn't Tomcat already has this capability. For
example, when we press a link that references to a image said
http://hostName:portNumber/ImageFile/myImage.jpeg from a browser, then image is
render by the web container to the browser so that the user on the other end can
see it. I thought all I have to do is to create a context for this purpose.
Where the context path for this web component points to the directory at /audio
instead of a directory under the webapps.


Thanks,
Kam On Thu, 01 Apr 2004 19:15:55 -0300, Emerson Cargnin wrote:



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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




--
Emerson Cargnin
Analista de Sistemas
Setor de Desenvolvimento de Sistemas - TRE-SC
tel : (048) - 251-3700 - Ramal 3181

---------------------------------------------------------------------
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]




--
Emerson Cargnin
Analista de Sistemas
Setor de Desenvolvimento de Sistemas - TRE-SC
tel : (048) - 251-3700 - Ramal 3181

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to