tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Arion" <ar...@talentinfo.com.hk>
Subject Re: How can I change the servlet path?
Date Wed, 01 Mar 2000 09:16:16 GMT
Hi!

I have read the specification, but I am still confused about some of the
points:

Is the reason for the servlet URL be <CONTEXT>/servlet/ because servlet is its
resource name and we are going to get this resource under this context? Is this
necessary meaning that we have no way to change the name?

If I want to use different name, must I specific the name for each servlet
using servlet-mapping?

Thanks

Arion

"Craig R. McClanahan" wrote:

> Arion wrote:
>
> > Hi!
> >
> > The default local path for CONTEXT is <CONTEXT docbase>/web-inf/classes,
> > am I right? How can I override the setting say <CONTEXT
> > docbase>/servlet?
> >
>
> You are confusing the class path for a context (used to locate all Java
> classes referenced by a web application, not just servlet classes) with the
> URL that is mapped to a particular servlet.
>
> The 2.2 servlet specification defines that all classes under
> WEB-INF/classes (and all JAR files under WEB-INF/lib) become part of the
> class path for a particular context.  However, this has nothing to do with
> how you access servlets found in those directories via a URL.
>
> If you use a URL like "/{context-path}/servlet/xxxxx", Tomcat looks for a
> class named "xxxxx" in one of the above two locations, or along the system
> class path if not found there.  It follows the usual Java rules for
> resolving classes that are inside packages.
>
> In addition, you can map a servlet to a specific path to a specific servlet
> using <servlet-mapping> element in the web.xml file.  Again, the class
> itself is located by looking in WEB-INF/classes, WEB-INF/lib/*.jar, or
> along the system class path.  See the servlet 2.2 specification for more
> details and examples.
>
> >
> > Thank you
> >
> > Arion
> >
>
> Craig McClanahan
>
> PS:  Tomcat 3.0 had a bug that prevented classes in WEB-INF/lib/*.jar from
> being found.  This has been fixed in more recent releases.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Mime
View raw message