Howdy,

>I'm running Tomcat 4.0.3 in conjunction with Apache 2 via mod_jk on
Windows
>2000 and Tru64 platforms.  I've been running a web app this way rather
>successfully for some time now -- but I'd like to make it compliant
with
>the
>WAR structure to ease deployment... so here's the problem:

Glad to hear it's working well, and glad to hear you're moving to a
standard and portable WAR structure.  I wish more people would do the
same.

>I've got my WAR & web.xml files working well for this configuration --
all
>servlets are expicitly defined in web.xml and mapped to a simplified
name -
>-
>minus all the package information -- so
>"com.wcom.mywebapp.servlet.HelloWorld" is simply mapped to
"/HelloWorld".

Very good practice.

>My server.xml file is ultra-simple:  No contexts are explicitly
defined.
>Tomcat automatically generates the "/mywebapp" context at startup.

Once again, very good practice.  Eliminates about half of the questions
and problems frequently encountered on this list and makes it much
easier for you to switch servers.

>However, I would like to be able to refer to the same servlet as:
>http://localhost/servlet/HelloWorld.

This desire requires being on the root context (the one with context
path "" as opposed to "mywebapp").  Therefore, you WILL need to put an
explicity context element in your server.xml, which includes:
<Context docBase="mywebapp.war" path="" ...>

Moreover, within your web.xml, you will need to add one more
servlet-mapping:
<servlet-mapping>
  <servlet-name>HelloWorldServlet</servlet-name>
  <url-pattern>/servlet/HelloWorld</url-pattern>
</servlet-mapping>

Personally, I don't like having more than one servlet-mapping per
servlet, but that's just my preference.  The standard allows many
mappings and tomcat allows many mappings without a problem.

I hope this helps,

Yoav Shapira
Millennium ChemInformatics



This e-mail, including any attachments, is a confidential business communication, and 
may contain information that is confidential, proprietary and/or privileged.  This 
e-mail is intended only for the individual(s) to whom it is addressed, and may not be 
saved, copied, printed, disclosed or used by anyone else.  If you are not the(an) 
intended recipient, please immediately delete this e-mail from your computer system 
and notify the sender.  Thank you.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to