tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kitching Simon <>
Subject RE: How can I avoid the String ".../servlet/..." in URL?
Date Tue, 05 Sep 2000 16:29:09 GMT

> -----Original Message-----
> From:	Nguyen, Hong Chau []
> Sent:	Tuesday, September 05, 2000 6:00 PM
> To:	''
> Subject:	How can I avoid the String  ".../servlet/..."  in URL?
> I have added following to my web.xml file:
> <servlet>
> 	<servlet-name>ServletName</servlet-name>
> 	<servlet-class>ServletClass</servlet-class>
> </servlet>
> <servlet-mapping>
> 	<servlet-name>ServletName</servlet-name>
> 	<url-pattern>/ServletName</url-pattern>
> </servlet-mapping>
> It works, but I don't want to make it for every servlet in my web-app. 
> Is there any other methods to do it at once for the whole servlets in my
> context?
	[Kitching Simon]  
	No, I doubt it. 

	To summarize, you don't want your servlets to have a prefix that the
	can use to tell them apart from html pages, and you don't want to
specify them
	one-by-one. So how is the webserver going to know what is a servlet
and what isn't???
	Yes, tomcat could check *every* url by searching for a class of the
same name, before
	looking for an html page (or vice versa) but that's a performance
hit I think you don't want.

	An alternative is for the webserver to look at every class in its
classpath to see if
	it is a servlet, and if so create a mapping from /classname to the
servlet class.
	Perhaps feasable, but this assumes a 1:1 mapping from class name to
	url, which generally is not desirable. And certainly not what tomcat

> Thanks in advance

View raw message