This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Tomcat and the fly likes Creating/Using Virtual Directory Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Creating/Using Virtual Directory" Watch "Creating/Using Virtual Directory" New topic
Author

Creating/Using Virtual Directory

Terri Baker
Greenhorn

Joined: Aug 10, 2011
Posts: 4
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

Joined: Apr 17, 2003
Posts: 327
"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


Thanks, leo
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15960
    
  19

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.


Customer surveys are for companies who didn't pay proper attention to begin with.
Terri Baker
Greenhorn

Joined: Aug 10, 2011
Posts: 4
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.
 
 
subject: Creating/Using Virtual Directory
 
Similar Threads
Why apache
Eclipse configuration
****ServletContext and WebApplication confusion****
Problem with connection pooling
weblogic to tomcat