Ralph,
I may be missing something, but it is quite easy to instatiate multiple
instances of a servlet class bound to different urls and with different
init parameters. The following web.xml extract does the job:
<web-app>
<servlet>
<servlet-name>OxfordLive</servlet-name>
<servlet-class>org.jafer.servlet.ZNGServlet</servlet-class>
<init-param>
<param-name>dataBase</param-name>
<param-value>advance</param-value>
</init-param>
<init-param>
<param-name>target</param-name>
<param-value>library.ox.ac.uk</param-value>
</init-param>
<init-param>
<param-name>port</param-name>
<param-value>210</param-value>
</init-param>
</servlet>
<servlet>
<servlet-name>OxfordTest</servlet-name>
<servlet-class>org.jafer.servlet.ZNGServlet</servlet-class>
<init-param>
<param-name>dataBase</param-name>
<param-value>advance</param-value>
</init-param>
<init-param>
<param-name>target</param-name>
<param-value>library.ox.ac.uk</param-value>
</init-param>
<init-param>
<param-name>port</param-name>
<param-value>211</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>OxfordLive</servlet-name>
<url-pattern>/ZNG</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>OxfordTest</servlet-name>
<url-pattern>/ZNGTest</url-pattern>
</servlet-mapping>
</web-app>
Matthew
-----Original Message-----
From: LeVan,Ralph
Sent: Mon 22/10/2001 21:26
To: [log in to unmask]
Cc:
Subject: Context in RPC calls
So, we're hiding the database name in the URL. The method
handling the RPC
has no access to URL information. How is it supposed to know
what database
the search is for?
Now, I thought I had the answer once. I was going to define a
separate
servlet for each database, but they would all use the same
servlet class.
Then, each servlet would get initialized with its own parameters
and things
would be great. But, the tomcat server knows that they are the
same servlet
and only creates one instance of it. So, I'm back to not
knowing what
database I'm supposed to be searching.
Now, I can do this myself, if I override the SOAP toolkit's
doPost method
and save the calling URL so that the searchRequest() method has
access to
it, but that seems like a hack.
Any thoughts on how to handle this?
Thanks!
Ralph
|