Win a copy of OCP Oracle Certified Professional Java SE 11 Developer Practice Tests this week in the OCP forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Ron McLeod
  • Tim Cooke
Sheriffs:
  • Devaka Cooray
  • paul wheaton
  • Mark Herschberg
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Frits Walraven
  • Jj Roberts
Bartenders:
  • Carey Brown
  • salvin francis
  • Piet Souris

virtual directory

 
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

I have all got my html files in a particular directory say: "C:\MyProject\test", I do not want to copy the contents of this folder in to tomcat webapp-web-inf, Can i associate a link such that when i type onthe url http://localhost/test it maps to the contents of physical folder "C:\MyProject\test"

Regards,
aakash
 
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
HTML files don't go in the WEB-INF directory.

if you have been constructing your webapp in c:\myproject\test (meaning, "test" is the root of your webapp, and you have a WEB-INF folder inside c:\myproject\test)... then you can use the Context element's docBase attribute.

Basically, Tomcat can host a webapplication from anywhere on your hard drive, not just from the webapps directory. You use docBase to tell it where to find the files.

But if you want *some* files under webapps and *some* files somewhere else, then this is different. As far as I'm aware, there's nothing like an Apache (web server) 'alias' directive for folders/URL paths. At an OS level, you can try things like symlinks, but Tomcat may not honour them. Windows is even more difficult.

Your best strategy is to have all your files in one place. If you insist on two places, then write a deployment script that does all the heavy lifting for you. ie: You'd run your deploy script, and it would do all the copying and moving files around for you.
 
Something about .... going for a swim. With this tiny ad ...
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic