• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Accessing wav files

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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"?
 
Bartender
Posts: 3648
16
Android Mac OS X Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This looks like more of Tomcat configuration issue. Moving
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Saloon Keeper
Posts: 27763
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Do Re Mi Fa So La Tiny Ad
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic