Win a copy of Microservices Testing (Live Project) this week in the Spring 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

Eclipse Config to Match Web Host

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?

Thanks!
 
Ranch Hand
Posts: 139
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't quite understand. However you can use <servlet-mapping> in web.xml to define the url pattern for your servlet.
 
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
reply
    Bookmark Topic Watch Topic
  • New Topic