tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jon Doe" <mobilephant...@hotmail.com>
Subject How does the deploy descriptor work?
Date Fri, 23 Jul 2004 20:10:36 GMT
I thought I understood this, but clearly I don't! (Or at least my app 
doesn't work.) So, if I may, I would like to explain my understanding of how 
you create the deploy descriptor, and how it works in Tomcat. Just to get 
some clarity.

OK, so I have a website, hosted as the context /mywebsite in Tomcat. So the 
localhost syntax to the root of this application is:

	http://localhost/mywebsite/

Now as I understand it, to get this URL to execute a servlet called Index 
(ie the class WEB-INF\classes\com\mywebsite\Index.class -- assumes Windows) 
I need to add this to the deployment descriptor:

	<servlet>
		<servlet-namemyRoot</servlet-name>
		<servlet-class>com.mywebsite.Index</servlet-class>
	</servlet>
	<servlet-mapping>
		<servlet-namemyRoot</servlet-name>
		<url-pattern>/</url-pattern>
	</servlet-mapping>

That is straight forward. Now what if I want /Login, /Register, /Catalogue, 
etc? What is the url-pattern for these? If I enter /Login, for example, will 
this the call that servlet when I use this URL:

	http://localhost/mywebsite/Login

If not, and I have to use a url-pattern of /mywebsite/Login, what happens if 
I decide to change the context path, or even to host it as a virtual server? 
Do I have to re-edit the web.xml file to reflect these changes?

One final question. If the url-pattern for Login is 
/mywebsite/Login.something, does this mean the user has to type:

	http://localhost/mywebsite/Login.something

for this to trigger? In short, is it the URL that is all important, and not 
the underlying filenames? (God knows how the wildcards work, so I've been 
trying to use 'full paths' as I thought this was easier. But I get no output 
even though I have lines writing to the ServletConfig log, to standard out 
and to the PrintWriter output!)

If anyone can comment on the above -- such as it is totally accurate, or it 
is all rubbish -- that would be useful!

Joe.

_________________________________________________________________
STOP MORE SPAM with the new MSN 8 and get 2 months FREE* 
http://join.msn.com/?page=features/junkmail


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message