I have registeread a domain and trying to deploy a war file in to the Appache tomcat server. Suppose
if my war file name is "foobar.war" then while deploying it will create a folder called "foobar", all my
web project structure under that only.So to access the domain I should have include the the directory
"foobar" also in to my URL(Ex: http://foobar.com/foobar/admin/sample.jsp) & It is irritating me.
So my expectation is I can access the domain like http://foobar.com/admin/sample.jsp.The tomcat server
I am using is a shared server.I know that some solution is there to resolve this issue.
So to access the domain I should have include the the directory "foobar" also in to my URL
That's only the first time if you try to access the site/application right? That's how it works since Tomcat is a container for multiple applications there should be a way to identify each. You also have the opportunity to use the "ROOT" context as you are already aware of. Other than that I don't think there's any other option rather than have a customized Tomcat server built in for this requirement .
First of all, it's not a "directory" name, it's a context name. As Vijatha has noted, Tomcat can host multiple applications at one time, and the context part of the URL indicates which application gets to process the URL request. The fact that Tomcat will by default take a war file and explode it into a directory with the same name as the WAR under the TOMCAT_HOME/webapps directory is purely an implementation detail not actually covered by the J2EE spec.
If you want an application to be at the root of a URL without a context name, you have to define it as the sole application within a virtual host. Tomcat allows setting up multiple virtual hosts, but it's not a minor task and from the sound of it, you don't have the rights to make the needed Tomcat configuration modifications in server.xml
More often, people front Tomcat with the Apache httpd server (or something like IIS) and set up a virtual host there that pipelines requests to the desired Tomcat URL context.
An IDE is no substitute for an Intelligent Developer.