Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Creating/Using Virtual Directory

 
Terri Baker
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am an applications specialist with no Tomcat background. Since no one in my organization is familiar with Tomcat, so I am hoping to get some help from this forum.

When installing my application there is an OPTIONAL step to create a virtual directory and to move all static resources there to accomplish a "significant performance boost." Currently we are using only a Lynix server with tomcat 6.0.29, but we plan to add a windows app server in the near future. My vendor will not provide any assistance with "third party products/applications or servers".

(1) Using Tomcat 6.0.29, would the performance boost actually be "significant" if I move the static resources there?
(2) If yes, then how do I create this virtual directory and how do I point my application there? (I did see an article about creating a virtual directory with Tomcat 5.5, but the slashes in step one were \ and in step two were / so I'm not sure of the accuracy of this post.)

Thank you so much in advance!
 
leo donahue
Ranch Hand
Posts: 327
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"When you install your application". Install it on an existing Tomcat instance? Or somewhere else?

Tomcat serves static resources as good as any other http server - my opinion.

You can create a virtual directory in Tomcat using a Context.

http://tomcat.apache.org/tomcat-6.0-doc/config/context.html
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18276
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What do you use to install your application? It doesn't sound like any of the standard Tomcat deployment processes.

In fact, I'm guessing that this is some sort of third-party installer and the "virtual directory" isn't actually part of the Tomcat system, it's a breakout for static content to be served up by a fronting server such as Apache httpd.

Long ago, there was a benefit to not having Tomcat serve up static content, because systems like Apache httpd could serve up static content much faster than Tomcat could. But that hasn't been an issue for at least 5 years, so you're unlikely to see any major benefits these days.

As far as mixing slashes and backslashes, that can be explained. When you're talking straight Windows, backslashes are the directory pathname separators in almost all cases. However, Java (and Unix-like stuff in general) uses the backslash as an escape character instead of as a plain text character, so in certain places, coding something like "C:\dead\rats" would actually produce an internal pathname of "C:deadrats", or even "C:dead<cr>ats", where "<cr>" is the invisible "carriage return" control character. Java, however, understands portable filename paths - as far as is possible, anyway. So you can code "C:/dead/rats" and get the proper effect, and in fact, in certain cases get filenames that work without change under both Windows and Linux.
 
Terri Baker
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you very much for your answers! I certainly picked the right place to ask my "newbie" questions. You have been extremely helpful. I will trust Tomcat to serve up the pages without the virtual directory. I especially appreciate the lesson on backslashes in Java.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic