Hi Rex,

I don't recall if this kind of pojo web service is just for jax-rpc or also 
jax-ws.  I don't have a complete solution in mind but here are some ideas that 
might be useful... feel free to ignore them or correct me :-)

- we need something at deploy time to take the non-servlet classes out of the 
info tree and record them in some kind of axis or axis2 or cxf appropriate 
data.  For at least axis1 I think we need to associate them with all the other 
info we get out of jaxrpc xml configurations and the wsdl that we parse.

- at runtime we need something to take this info and construct the servlet 
instance and add it to the servlet context.  From the point of view of the 
servlet containers using a ServletContainerInitializer would be the cleanest 
approach.  However, normal ServletContainerInitializers are constructed just 
from their class names for each servlet context, so there's no external way to 
configure them.  Using these I think we'd need to store the info from (1) as a 
resource in the deployed war ( or for wabs, in the osgi bundle data area). 

-- possibly we could extend the ServletContainerInitializer support so 
something such as a gbean can construct and configure one and register it with  
the StandardContext.addServletContainerInitializer method.  The gbean could 
include the necessary configuration from deploy time.  This gbean would be one 
gbean for all the web services in the web app, not one for each web service 
which was what the old code used.

Hope this is helpful!
david jencks

On Jan 18, 2011, at 11:29 PM, Rex Wang wrote:

> Hi David,
> 
> I was planning first make the old functions work and then see if we can make 
> any improvements, because it blocks a lot of tck cases.
> I am not very familiar with the codes in tomcatmodulebuilder, however I would 
> like to try the approach you pointed out, so I have reverted the changes. 
> 
> thanks and regards,
> 
> 2011/1/18 David Jencks <[email protected]>
> Hi,
> 
> Could you explain how you are planning to make this work?  It's not obvious 
> to me.  From this it looks like you are reintroducing a gbean for each pojo 
> web service which is a very different approach than what is used for the 
> actual servlets in the web app.
> 
> If I remember correctly there was some very peculiar code related to these 
> servlets for pojo web services since the servlet instance needed to be 
> configured with  the actual objects that deal with the web service 
> processing,  and formerly there was no plausible way to do this.  With the 
> servlet 3 capabilities I was hoping that we can directly construct and 
> configure the servlet object and add it to the servlet context.
> 
> thanks
> david jencks
> 
> On Jan 17, 2011, at 6:58 PM, [email protected] wrote:
> 
> > Author: rwonly
> > Date: Tue Jan 18 02:58:42 2011
> > New Revision: 1060171
> >
> > URL: http://svn.apache.org/viewvc?rev=1060171&view=rev
> > Log:
> > re-enable the codes that deal with the web service fake servlet
> >
> > Modified:
> >    
> > geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7-builder/src/main/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java
> >
> > Modified: 
> > geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7-builder/src/main/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java
> > URL: 
> > http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7-builder/src/main/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java?rev=1060171&r1=1060170&r2=1060171&view=diff
> > ==============================================================================
> > --- 
> > geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7-builder/src/main/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java
> >  (original)
> > +++ 
> > geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7-builder/src/main/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java
> >  Tue Jan 18 02:58:42 2011
> > @@ -52,6 +52,7 @@ import org.apache.geronimo.gbean.Abstrac
> > import org.apache.geronimo.gbean.GBeanData;
> > import org.apache.geronimo.gbean.GBeanInfoBuilder;
> > import org.apache.geronimo.gbean.GBeanLifecycle;
> > +import org.apache.geronimo.gbean.ReferencePatterns;
> > import org.apache.geronimo.gbean.annotation.GBean;
> > import org.apache.geronimo.gbean.annotation.ParamAttribute;
> > import org.apache.geronimo.gbean.annotation.ParamReference;
> > @@ -581,7 +582,7 @@ public class TomcatModuleBuilder extends
> >
> >             webModuleData.setAttribute("contextAttributes", 
> > contextAttributes);
> >
> > -            //Handle the role permissions and webservices on the servlets.
> > +            //Handle webservices and the role permissions on the servlets.
> >             List<org.apache.openejb.jee.Servlet> servletTypes = 
> > webApp.getServlet();
> >             Map<String, AbstractName> webServices = new HashMap<String, 
> > AbstractName>();
> >             Class<?> baseServletClass;
> > @@ -590,43 +591,46 @@ public class TomcatModuleBuilder extends
> >             } catch (ClassNotFoundException e) {
> >                 throw new DeploymentException("Could not load 
> > javax.servlet.Servlet in bundle " + bundle, e);
> >             }
> > -//            for (org.apache.openejb.jee.Servlet servletType : 
> > servletTypes) {
> > -//
> > -//                if (servletType.getServletClass() != null) {
> > -//                    String servletName = 
> > servletType.getServletName().trim();
> > -//                    String servletClassName = 
> > servletType.getServletClass().trim();
> > -//                    Class servletClass;
> > -//                    try {
> > -//                        servletClass = 
> > webBundle.loadClass(servletClassName);
> > -//                    } catch (ClassNotFoundException e) {
> > -//                        throw new DeploymentException("Could not load 
> > servlet class " + servletClassName + " from bundle " + bundle, e);
> > -//                    }
> > -//                    if 
> > (!baseServletClass.isAssignableFrom(servletClass)) {
> > -//                        //fake servletData
> > -//                        AbstractName servletAbstractName = 
> > moduleContext.getNaming().createChildName(moduleName, servletName, 
> > NameFactory.SERVLET);
> > -//                        GBeanData servletData = new GBeanData();
> > -//                        servletData.setAbstractName(servletAbstractName);
> > -//                        //let the web service builder deal with 
> > configuring the gbean with the web service stack
> > -//                        //Here we just extract the factory reference
> > -//                        boolean configured = false;
> > -//                        for (WebServiceBuilder serviceBuilder : 
> > webServiceBuilder) {
> > -//                            if 
> > (serviceBuilder.configurePOJO(servletData, servletName, module, 
> > servletClassName, moduleContext)) {
> > -//                                configured = true;
> > -//                                break;
> > -//                            }
> > -//                        }
> > -//                        if (!configured) {
> > -//                            throw new DeploymentException("POJO web 
> > service: " + servletName + " not configured by any web service builder");
> > -//                        }
> > -//                        ReferencePatterns patterns = 
> > servletData.getReferencePatterns("WebServiceContainerFactory");
> > -//                        AbstractName wsContainerFactoryName = 
> > patterns.getAbstractName();
> > -//                        webServices.put(servletName, 
> > wsContainerFactoryName);
> > -//                        //force all the factories to start before the 
> > web app that needs them.
> > -//                        
> > webModuleData.addDependency(wsContainerFactoryName);
> > -//                    }
> > -//
> > -//                }
> > -//            }
> > +
> > +
> > +            // web services fake servlet
> > +            for (org.apache.openejb.jee.Servlet servletType : 
> > servletTypes) {
> > +
> > +                if (servletType.getServletClass() != null) {
> > +                    String servletName = 
> > servletType.getServletName().trim();
> > +                    String servletClassName = 
> > servletType.getServletClass().trim();
> > +                    Class servletClass;
> > +                    try {
> > +                        servletClass = 
> > webBundle.loadClass(servletClassName);
> > +                    } catch (ClassNotFoundException e) {
> > +                        throw new DeploymentException("Could not load 
> > servlet class " + servletClassName + " from bundle " + bundle, e);
> > +                    }
> > +                    if (!baseServletClass.isAssignableFrom(servletClass)) {
> > +                        //fake servletData
> > +                        AbstractName servletAbstractName = 
> > moduleContext.getNaming().createChildName(moduleName, servletName, 
> > NameFactory.SERVLET);
> > +                        GBeanData servletData = new GBeanData();
> > +                        servletData.setAbstractName(servletAbstractName);
> > +                        //let the web service builder deal with 
> > configuring the gbean with the web service stack
> > +                        //Here we just extract the factory reference
> > +                        boolean configured = false;
> > +                        for (WebServiceBuilder serviceBuilder : 
> > webServiceBuilder) {
> > +                            if (serviceBuilder.configurePOJO(servletData, 
> > servletName, module, servletClassName, moduleContext)) {
> > +                                configured = true;
> > +                                break;
> > +                            }
> > +                        }
> > +                        if (!configured) {
> > +                            throw new DeploymentException("POJO web 
> > service: " + servletName + " not configured by any web service builder");
> > +                        }
> > +                        ReferencePatterns patterns = 
> > servletData.getReferencePatterns("WebServiceContainerFactory");
> > +                        AbstractName wsContainerFactoryName = 
> > patterns.getAbstractName();
> > +                        webServices.put(servletName, 
> > wsContainerFactoryName);
> > +                        //force all the factories to start before the web 
> > app that needs them.
> > +                        
> > webModuleData.addDependency(wsContainerFactoryName);
> > +                    }
> > +
> > +                }
> > +            }
> >
> >
> >             webModuleData.setAttribute("webServices", webServices);
> >
> >
> 
> 
> 
> 
> -- 
> Lei Wang (Rex)
> rwonly AT apache.org

Reply via email to