cxf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Willem Jiang <ning.ji...@iona.com>
Subject Re: Difference between cxf.xml and cxf-servlet.xml?
Date Thu, 22 Nov 2007 02:46:39 GMT
Hi Glen,

Please see my comments in the mail.
Glen Mazza wrote:
> Thanks.  Two more questions:
>
> 1.)  For server-side, what generally is in the cxf.xml that is *not* in
> the Spring ApplicationContext beans.xml file?  Why might cxf.xml still
> be needed if you already have defined a Spring ApplicationContext?
>   
We have too much cxf.xml here.
One is in the cxf-core module which holds the whole core components 
information.
The other is the default user configuration file which name is also 
cxf.xml.
When cxf creates the bus ,  it will search the class path for cxf.xml 
automatically.
> 2.)  The link[2] you gave below is unfortunately showing more
> complexity.  There are apparently two possible cxf.xml's:
>
> a.) One that the user manually places in the classpath (which is the one
> I was talking about earlier)
>
> b.) One that sits in the META-INF/cxf directory of
> lib/cxf-2.0.3-incubator.jar of the CXF download.
>
> What is the difference between (a) and (b) besides location?  What
> functionality is different between the two, what is the difference in
> their purpose?
>   
Oops , you almost get the answer here if you look at the file :)
a) is the user 's configuration , in most case , it only contains the 
endpoints information or some bus configuration.
b) is the cxf core components wiring file, which helps to initialize the 
core components and wire them with cxf bus.

Cheers,

Willem.
> Thanks,
> Glen
>
> Am Donnerstag, den 22.11.2007, 09:28 +0800 schrieb Willem Jiang:
>   
>> Hi ,
>> There are several  phases of the configuration loading in CXFServlet. 
>> Please ref [1]'s loadBus() for more information
>> 1. Loading the Spring ApplicationContext from the ServletConfig, which 
>> means the bean.xml will take effect first, and create the Spring Bus 
>> with this application context.
>> 2. If the applicationContext is null , CXFServlet will create a 
>> springBus with out this applicationContext
>> 3. After the bus initialized,  CXFServlet try to load  cxf-servlet.xml 
>> for publishing the endpoints
>>
>> For the SpringBus initializing, there are also several steps to look up  
>> the configuration files,  please ref [2]'s getConfigResources() method  
>> for more information
>> 1. Checking if there is a bus named with cxf in the applicationContext, 
>> if the bus is already there , we do not need search the core and cxf 
>> extension spring configuration resources.
>> 2. If SpringBus is not create with cfgFile (file name or url) specified 
>> , it will find user defined configuration form the the system property 
>> "cxf.config.file" and "cxf.config.file.url"
>>  
>> [1]https://svn.apache.org/repos/asf/incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/CXFServlet.java
>> [2]https://svn.apache.org/repos/asf/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/BusApplicationContext.java
>>
>> Willem.
>>
>>
>> Benson Margulies wrote:
>>     
>>> I see log messages indicating that CXF is looking for cxf.xml even when
>>> I have my own beans. My guess is that unless you initialize the entire
>>> system (starting from the bus) CXF will always look for cxf.xml, and, in
>>> fact, there may be no conditions in which it fails to do that.
>>>
>>>   
>>>       
>>>> -----Original Message-----
>>>> From: Glen Mazza [mailto:glen.mazza@verizon.net] 
>>>> Sent: Wednesday, November 21, 2007 1:10 PM
>>>> To: cxf-dev@incubator.apache.org
>>>> Subject: Re: Difference between cxf.xml and cxf-servlet.xml?
>>>>
>>>> OK, I'm still researching all of this (and others' related 
>>>> emails) to update the documentation--but I have one question 
>>>> left:  Does anyone know, that if I have *both* a Spring 
>>>> configuration file (i.e., the "beans.xml"[1] file in the 
>>>> java_first_spring_support sample below) declared in the 
>>>> web.xml[2] and cxf.xml in the classpath, if *both* will be 
>>>> loaded?  Or does the former prevent the latter from being 
>>>> loaded and processed?  The CXF source code that covers this 
>>>> is somewhat cryptic but I can research it more thoroughly if 
>>>> necessary.
>>>>
>>>> Thanks,
>>>> Glen
>>>>
>>>> [1] http://tinyurl.com/352htd
>>>> [2] http://tinyurl.com/3djrlz
>>>>
>>>> Am Freitag, den 16.11.2007, 10:53 +0800 schrieb Jeff Yu:
>>>>     
>>>>         
>>>>> java_first_spring_support sample "beans.xml", it doesn't 
>>>>>       
>>>>>           
>>>> need to have 
>>>>     
>>>>         
>>>>> a cxf-servlet.xml  in the WEB-INF folder.
>>>>>       
>>>>>           
>>>> Excellent example.  Thanks for pointing it out.
>>>>
>>>>     
>>>>         
>>>>> In fact, the cxf-servlet.xml just replace the http 
>>>>>       
>>>>>           
>>>> transport ID to the 
>>>>     
>>>>         
>>>>> servlet. ( in this case, the cxf-servlet.xml in the 
>>>>> cxf-rt-transports-http module).
>>>>>
>>>>>       
>>>>>           
>>>> Good point.  I just noticed there are two different 
>>>> cxf-servlet.xml's, the one above (in META-INF of the CXF JAR) 
>>>> just does the above as you're saying.
>>>>
>>>>
>>>>     
>>>>         
>>>>> The reason why the cxf-servlet.xml in the WEB-INF folder 
>>>>>       
>>>>>           
>>>> would works, 
>>>>     
>>>>         
>>>>> in this case, the cxf-servlet.xml contains the endpoint 
>>>>>       
>>>>>           
>>>> configuration 
>>>>     
>>>>         
>>>>> such as<jaxws:endpoint>.., because we define a 
>>>>> "<servlet-name>cxf</servlet-name>" in the web.xml, by default,
it 
>>>>> would pick up the "cxf-servlet.xml" in the war..
>>>>>
>>>>>       
>>>>>           
>>>> Actually, that is exactly how Spring MVC's DispatcherServlet 
>>>> works, xxxx-servlet.xml; but in our CXFServlet class it is 
>>>> hardcoded to look for a "cxf-servlet.xml" no matter what the 
>>>> servlet-name is.
>>>>
>>>>
>>>>     
>>>>         
>>>>> so, to be specific, which case of cxf-servlet.xml do you 
>>>>>       
>>>>>           
>>>> refer to? For 
>>>>     
>>>>         
>>>>> the cxf-servlet.xml in the WEB-INF folder, it is optional. 
>>>>>       
>>>>>           
>>>> You can do 
>>>>     
>>>>         
>>>>> as same as java_first_spring_support sample did...
>>>>> use another xml, and then ask spring's 
>>>>>       
>>>>>           
>>>> ContextLoaderListener to load it..
>>>>     
>>>>         
>>>>> Thanks
>>>>> Jeff
>>>>>
>>>>> Glen Mazza wrote:
>>>>>       
>>>>>           
>>>>>> Do we have a sample anywhere of the syntax of 
>>>>>>         
>>>>>>             
>>>> this--specifying the 
>>>>     
>>>>         
>>>>>> Spring app context in the XML, and what such a config file would

>>>>>> look like?
>>>>>>
>>>>>> Thanks,
>>>>>> Glen
>>>>>>
>>>>>> Am Donnerstag, den 15.11.2007, 11:12 -0500 schrieb Jiang, 
>>>>>>         
>>>>>>             
>>>> Ning (Willem):
>>>>     
>>>>         
>>>>>>   
>>>>>>         
>>>>>>             
>>>>>>> If you specify the Spring application context in your 
>>>>>>>           
>>>>>>>               
>>>> web.xml file.
>>>>     
>>>>         
>>>>>>> You do not need to touch any of cxf.xml and cxf-servlet.xml.
>>>>>>>
>>>>>>> I admit that CXF provides lots of configuration here.
>>>>>>>
>>>>>>> Willem.
>>>>>>>
>>>>>>> -----Original Message-----
>>>>>>> From: Randy Burgess [mailto:RBurgess@nuvox.com]
>>>>>>> Sent: Thu 11/15/2007 21:52
>>>>>>> To: cxf-user@incubator.apache.org
>>>>>>> Subject: Re: Difference between cxf.xml and cxf-servlet.xml?
>>>>>>>  
>>>>>>> I don't even use either file and my services work without any

>>>>>>> issues. I use applicationContext*.xml files since I was using

>>>>>>> Spring before CXF and didn't see the point in creating either.
>>>>>>>
>>>>>>> Regards,
>>>>>>> Randy Burgess
>>>>>>> Web Applications Developer
>>>>>>> Nuvox Communications
>>>>>>>
>>>>>>>
>>>>>>>           
>>>>>>>               
>>>>     
>>>>         
>>>   
>>>       
>
>   

Mime
View raw message