geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Jencks <>
Subject Re: Writing dummy Servlet to redirect HTTP/SOAP requests
Date Wed, 15 Dec 2004 05:42:17 GMT

On Dec 14, 2004, at 9:06 PM, Srinath Perera wrote:

> Hi All;
> I like to write a dummy Servlet that would look like this
> 	Public class Dummy implements HTPServlet,GBeanLifeCycle{
> 		final AxisGBEan axis
>  static {
>         		GBeanInfoBuilder infoFactory =  ...
>         	infoFactory.addReferance("Axis", AxisGBean.class);
>        	 	infoFactory.setConstructor(new String[]{"Axis"});
>        		 GBEAN_INFO = infoFactory.getBeanInfo();
>     		}
> public ConstructorInjectionGbean(AxisGBean axis )     {
> 			this.axis = axis;
> }
> 		Public void doPost(HttpRequest req,HttpResponse res){
> 			axis.processSOAPMesage(req,rsp);
> }
> }
> Will this work? As usually servlets do sandboxing and does the usual
> Geronimo services applicable inside the Servlet to inject the
> AxisGBean. [If constructor is a problem we can use getter setter
> injection]

I don't think exactly this will work.  I have two related ideas that 
will work;

1.  Supply the kernel name and axis gbean object name as init params 
for the servlet.  The init method can then get the actual kernel using 
the kernel name

Kernel kernel = Kernel.getKernel(kernelName);

and get a proxy to the axis gbean using its object name (don't remember 
the code).  This could be done with the current web deployment 

2.  I think an even better approach is to extend JettyServletHolder to 
include a reference to the AxisGBean and to construct the servlet 
instance with the reference.  Since we would control the construction 
of the servlet, it could have a non-default constructor.  This would 
require writing some web services deployment code that would process 
the web services dd and add gbeans to the context directly.

> What I want to achieve with this is to make it possible to deploy each
> WS in Geronimo with own web.xml file; Axis is a Servlet and have a one
> web.xml to all the Web Services. I had a chat about this with Jeremy
> sometime ago and following his pointers . I am trying to create a
> Dummy Servlet for each Web Service and deploy the Servlet with own
> web.xml file and when the SOAP request comes it is redirected Axis
> with the security and transaction contexts set in to the Thread!!

That sounds good, although I think constructing the gbeans directly 
rather than writing out a preprocessed or generated web.xml will be a 
better solution.  Wiring the parts of axis together with gbean 
references is definitely a good idea!
> There is a another advantage of this approach that I would be able
> rewrite   Axis deployment registry with GBeans and using a reference
> patterns when ever a Web Service application GBean start up it will
> injected to the Registry. That means we can have a much Geronimo like
> deployment for Axis (I am doing a SOAP call now) and would be able to
> start stop each web service by start stopping GBean corresponding to
> the Web Service.

Good idea!

david jencks

> Thanks
> Srinath

View raw message