Forums Register Login

Dispatch request to non defined servlets

+Pie Number of slices to send: Send
I've servlets that are in the WEB-INF/lib directory, however, I want to be able to dispatch requests to them without defining them in web.xml file.
Is this possible? The reason I want to do this is because I am putting in new servlets in application server's class loader, and do not want to go through every webapps to add the servlets.
How about dispatching requests to servlets that are defined in web.xml, but not mapped to a URL.
Thanks in advance.
+Pie Number of slices to send: Send
 

Originally posted by Chu Tan:
...The reason I want to do this is because I am putting in new servlets in application server's class loader, and do not want to go through every webapps to add the servlets.


Depends on the servlet container or the application server that you are using. In Tomcat, there is a web.xml file in the TOMCAT_HOME/conf directory. This web.xml defines the default elements for all the webapps. For example, there are five pre-defined servlets named default, invoker, jsp, ssi, and cgi. You can add your new servlets and their url-mappings and they too will be available to all the webapps. And since url-mappings are relative to the webapp context, the same mapping will work for all the webapps; you don't have to map them individually for each webapp unless you want to override or extend the common one.
Is that what you were looking for?
Hope that helps,
-j
[ February 25, 2003: Message edited by: Jignesh Malavia ]
+Pie Number of slices to send: Send
yes, that should solve my problem..
I was trying to find out documentations of directly accessing servlets by their classname.
eg.
http://server/ctx/servlets/com/test/MyServlet
Can't seem to work on Tomcat 4.1.12 . Is it still supported? Does it allow loading servlets from webapp, common and shared scopes? Are there security issues regarding this?
+Pie Number of slices to send: Send
First of all, the way to call servlets by their name is:
http://server/ctx/servlet/com.company.TestServlet
Since Tomcat 4.1.12, this pattern is no longer valid, it has been *deprecated* by security reasons.
However, you can activate it by "decommenting" the following code fragment in the
%TOMCAT_HOME%conf/web.xml,

In the file, this code is commented.
You also can include this code in the web application web.xml file only.
I didn't do it. You can't prove it. Nobody saw me. The sheep are lying! This tiny ad is my witness!
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 681 times.
Similar Threads
Generating requests from servlets
I'm completely new to JSP's how does it compare to...
Jrun web.xml file.
All about action servlet
Work Manager - Default and Global Work Manger - Which one get used ?
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 04:12:32.