Hi

I had resolved this issue by using JettyHTTPServerEngineBeanDefinitionParser to parse the <engine> element and call the bean.addPropertyValue("enginesList", list) to inject the spring instantiated engines to the jetty engine factory.

 You can find the codes from this URL[1] .

I must misunderstand the spring file parsing with the customer bean's object instantiating.

Anyway, now you could set up the CXF standalone Jetty engine's connector and handlers within CXF spring configuration.

 Cheers,

Willem

[1] http://svn.apache.org/viewvc?view=rev&revision=560509

Willem Jiang wrote:
Hi,

I am working on adding the some HTTP Jetty Engine configuration support, and now fighting with the spring APIs.
My question is how can I get
*<beans:bean class="org.mortbay.jetty.bio.SocketConnector"/>
*the bean's instance in the * *AbstractBeanDefinitionParser's doParse method ?* *

I changed the http-jetty.xsd, wanted to add some supports for adding connector and handlers by using the spring bean's syntax.

<xs:complexType name="JettyHTTPServerEngineConfigType">
      <xs:sequence>
        <xs:choice minOccurs="0" maxOccurs="1">
         <xs:element name="tlsServerParameters"
                     type="sec:TLSServerParametersType"/>
         <xs:element name="tlsServerParametersRef"
                     type="tns:ParametersRefType"/>
        </xs:choice>
        <xs:choice minOccurs="0" maxOccurs="1">
         <xs:element name="threadingParameters"
                     type="tns:ThreadingParametersType"/>
         <xs:element name="threadingParametersRef"
                     type="tns:ParametersRefType"/>
</xs:choice> * <xs:element name="connector" type="xsd:anyType" minOccurs="0"/>
        <xs:element name="handlers" type="xsd:anyType" minOccurs="0"/>
<xs:element name="useSession" type="xsd:boolean" minOccurs="0"/> *
      </xs:sequence>
         <xs:attribute name="port" type="xs:int" use="required"/>
   </xs:complexType>

The Bean's xml
<beans xmlns="http://www.springframework.org/schema/beans";
xmlns:beans="http://www.springframework.org/schema/beans"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
      xmlns:h="http://cxf.apache.org/transports/http/configuration";
xmlns:hj="http://cxf.apache.org/transports/http-jetty/configuration";
      xmlns:sec="http://cxf.apache.org/configuration/security";
      xsi:schemaLocation="
       http://www.springframework.org/schema/beans
           http://www.springframework.org/schema/beans/spring-beans.xsd
       http://cxf.apache.org/configuration/security
           http://cxf.apache.org/schemas/configuration/security.xsd
       http://cxf.apache.org/transports/http/configuration
           http://cxf.apache.org/schemas/configuration/http-conf.xsd
       http://cxf.apache.org/transports/http-jetty/configuration
           http://cxf.apache.org/schemas/configuration/http-jetty.xsd";
>
<hj:engine-factory bus="cxf">
      <hj:identifiedThreadingParameters id="sampleThreading1">
         <hj:threadingParameters minThreads="111" maxThreads="120"/>
      </hj:identifiedThreadingParameters>
           <hj:engine port="9000">
         <hj:threadingParametersRef id="sampleThreading1"/>
      </hj:engine>
           <hj:engine port="0">
         <hj:threadingParameters minThreads="99" maxThreads="777"/>
      </hj:engine>
           <hj:engine port="9001">
      <hj:connector>
       *     <beans:bean class="org.mortbay.jetty.bio.SocketConnector">
            <beans:property name = "port" value="9001" />*
        </beans:bean>
      </hj:connector>
      <hj:handlers>
*<beans:bean class="org.mortbay.jetty.handler.DefaultHandler"/> *
      </hj:handlers>
     <hj:sessionSupport> true </hj:sessionSupport>
     </hj:engine>
   </hj:engine-factory>
</beans>

When I try to parser the connector and handlers parameters , I need a way to get the *<beans:bean ... * represent object instance from the parser context.
But when I use the below code to get the handlers list,

ctx.getDelegate().parseListElement((Element) element, bean.getBeanDefinition());

I just get a bunch of BeanDefinitionHolders and I can't get the bean's represent object instance. I know I can use the beanFactory.getBean(beanName) to get the bean's represent object instance ,but I don't know how to get the beanFactory from the parser context.

Can I get the bean's object instance in the AbstractBeanDefinitionParser doParse method ?

Maybe I missed some magic things of spring , I am really a new guy to using spring.

BTW
I had try to paraser the <hj:engine > element by register another JettyHTTPServerEngineBeanDefinitionParser
<hj:engine-factory>  <hj:engine>
  </hj:engine>
</hj:engine-factory>

And because engine is in the engine-factory block, I can't see any JettyHTTPServerEngine object created after I used a applicationContext to load the bean.xml. But I can see the JettyHTTPServerEngineFactory's instance is created after bean.xml is loaded.

I use the ctx.getDelegate().parseCustomElement(first, bean.getBeanDefinition()); to parser the <hj:engine> element, but I don't call the bean.addPropertyReference(). Can I create the JettyHTTPServerEngine instance in the JettyHTTPServerEngineFactoryBeanDefinitionParser's doParser method?

Thanks,

Willem

Reply via email to