aspose file tools*
The moose likes Tomcat and the fly likes Accessing wav files Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Accessing wav files" Watch "Accessing wav files" New topic
Author

Accessing wav files

Michael Reynolds
Greenhorn

Joined: Dec 26, 2005
Posts: 12
I am rather new to Tomcat and only a little more experienced in the ways of JAVA. My windows application needs to access WAV files via HTTP. I would like to access files in say... "C:/prompts" on my server "//10.20.30.40:8080" for example. How do I make this path visible via HTTP? Is there a configuration file with which I can point to my virtual directory so that the URL becomes something like: "http://10.20.30.40:8080/Prompts"?
K. Tsang
Bartender

Joined: Sep 13, 2007
Posts: 1973
    
    7

This looks like more of Tomcat configuration issue. Moving


K. Tsang JavaRanch SCJP5 SCJD/OCM-JD OCPJP7
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39576
    
  27
You would use the docBase attribute of the Context element to point to an arbitrary directory outside of the Tomcat installation: http://tomcat.apache.org/tomcat-7.0-doc/config/context.html


Ping & DNS - updated with new look and Ping home screen widget
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15662
    
  15

The simplest way would be to merely include copies of the wav files as part of your WAR and not attempt to kludge around things.

Relocating the entire WAR (as Ulf suggested) probably wouldn't do what you wanted, since the ENTIRE war has to be relocated, but depending on how things are set up, it might be a possibility.

Windows added a file aliasing feature similar to Unix/Linux softlinks a few years back, and this can be used to make the WAV directory appear to be part of the WAR, although you may have to change some settings in server.xml, since softlinks are somewhat of a security issue and thus disabled by default.

And then there's the old standby: write a servlet that copies the WAV from its actual external home out to the HttpResponse output stream (which is what the default servlet does for in-WAR files anyway).


Customer surveys are for companies who didn't pay proper attention to begin with.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39576
    
  27
Tim Holloway wrote:Relocating the entire WAR (as Ulf suggested) probably wouldn't do what you wanted, since the ENTIRE war has to be relocated

Actually, what I meant -but didn't say explicitly- was to create a second web app that would do nothing but serve files from this directory. I agree that moving the entire web app would likely not be a practical approach.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Accessing wav files
 
Similar Threads
how to read content of a site?
internal or external request.
Question about java.lang.SecurityException
Edit audio meta tag
Tomcat Setup