Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Accessing wav files

 
Michael Reynolds
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3444
13
Android Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This looks like more of Tomcat configuration issue. Moving
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18161
53
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic