I use Eclipse/Tomcat 6.0 as my IDE. When I run a servlet it uses the URL //locahost/<dynamic Web project name>/TheServlet
My servlet hosting provider however has me use the virtual directory name of 'servlet' to access the servlet (for example, http://www.mydomain.com/servlet/TheServlet
Because my code locally is written one way (referring to my dynamic Web project name) and my code up on the server needs to be different (using the virtual directory name 'servlet') it is causing me to keep two copies of my code.
Is there any way to configure Eclipse/Tomcat 6.0 locally so that I can refer to servlets using the 'servlet' virtual directory name so I don't have to have two separate copies of my code?
Paul Hoffman wrote:My servlet hosting provider however has me use the virtual directory name of 'servlet' to access the servlet (for example, http://www.mydomain.com/servlet/TheServlet
So your hosting provider is pushing you to use the InvokerServlet of their Tomcat machine?
Bad idea. I would look for another hosting provider. If that is really not an option, you could consider creating a Filter to 'mask' the URL. But again, this isn't a good idea. I also have never seen a hosting provider which does so. This makes namely no sense.
Why did they push you to do so? Were you encountering problems and were you asking them for help and did the one probably not understand the other or so? What hosting provider is it by the way? How do you deploy webapps to there? As a WAR? Or isn't that allowed either? Well, OK, then I can understand the need for InvokerServlet. I would still look for a better hosting provider where you can deploy WAR's.