cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brice <brice.duth...@gmail.com>
Subject Re: About annotation inheritance, and HTTP properties
Date Mon, 30 Jun 2008 17:06:00 GMT
>
> Ok, so to have a REST client we can use the following code in Java.
> ==============================
>>
>> =======================
>> JaxWsProxyFactoryBean sf = new JaxWsProxyFactoryBean();
>> sf.setServiceClass(RestService.class);
>> sf.getServiceFactory().setWrapped(false);
>>
>> sf.getClientFactoryBean().setBindingId(HttpBindingFactory.HTTP_BINDING_ID);
>> // Allow the client to understand Rest
>> sf.setAddress("http://localhost:8080/xml/");
>> CustomerService cs = (CustomerService)sf.create();
>> =====================================================
>>
>
>
> Looks like this time you're looking at the CXF-private HttpBinding - this
> is completely orthogonal to what CXF JAX-RS offers and it's not well
> mantained.
>

Yes, I know this way of building a REST client is a bit tricky, but there is
no other that I know about.
As I didn't yet looked at the client with jaxrs annotations, mine is still
based on the jra project from codehaus, maybe this client wont be able to
understand or process the jaxrs annotations.

Is there a JaxRsClientFactoryBean project on the way, this is really a
missing component in CXF as REST is becoming more popular (and for good
reasons).


On Mon, Jun 30, 2008 at 18:29, Sergey Beryozkin <sergey.beryozkin@iona.com>
wrote:

> Hi Brice
>
>> Ok, I understand better the case, I just read in surface the
>> specification,
>> I am not well aware then of those recommendations.
>> I only saw that the jaxrs annotations are not annotated with @Inherited,
>> but
>> it's okay if CXF implementation do the job to check the interfaces. I hope
>> this will be integrated as soon as possible to avoid bad programmation
>> behavior.
>>
>
> ok
>
>
>> Sorry I mixed up things yesterday night. I was thinking about Timeouts
>> Well our application should be coherent in the way that the integrators
>> should only have properties file to modify.
>>
>> Here's a Spring configuration that works well, the timeouts are correctly
>> set on the conduit
>> =====================================================
>> <bean id="conf"
>>
>> class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
>>
>> <http-conf:conduit name="*RestService.http-conduit" >
>>   <http-conf:client
>>       ReceiveTimeout="5000"
>>       ConnectionTimeout="5000"
>>       />
>>
>>   <http:authorization>
>>       <sec:UserName>usernamehere</sec:UserName>
>>       <sec:Password>passwordhere</sec:Password>
>>   </http:authorization>
>> </http-conf:conduit>
>> =====================================================
>>
>> But if I want to use properties like that
>> =====================================================
>>   <http-conf:client
>>       ReceiveTimeout="${http.receive.timeout}"
>>       ConnectionTimeout="${http.connection.timeout}"
>>       />
>> =====================================================
>> Then the xml declaration is no more valid because the properties datatype
>> should be unsignedInteger.
>>
>>
> This sounds reasonable, it's not a  CXF JAX-RS though. Perhaps Dan or
> someone else can look at your proposal
> in more details...
>
>
>>>
>>>
>>>> And last question, do you plan to create JAXRSClient factory bean, right
>>>> know using the JaxWsPRoxyFactoryBean is a bit intricate when declaring
>>>> it
>>>> in
>>>> a Spring application context and setting properties like setWrapped.
>>>>
>>>>
>>> Please expand on it a bit more too.
>>>
>>
>>
>> Ok, so to have a REST client we can use the following code in Java.
>> =====================================================
>> JaxWsProxyFactoryBean sf = new JaxWsProxyFactoryBean();
>> sf.setServiceClass(RestService.class);
>> sf.getServiceFactory().setWrapped(false);
>>
>> sf.getClientFactoryBean().setBindingId(HttpBindingFactory.HTTP_BINDING_ID);
>> // Allow the client to understand Rest
>> sf.setAddress("http://localhost:8080/xml/");
>> CustomerService cs = (CustomerService)sf.create();
>> =====================================================
>>
>
>
> Looks like this time you're looking at the CXF-private HttpBinding - this
> is completely orthogonal to what CXF JAX-RS offers and it's not well
> mantained.
>
> Cheers, Sergey
>
>
>
>
>> However if I want to create a Spring bean of this service (without
>> creating
>> a custom BeanFactory), we need to look into the factory to set some
>> properties like the "wrapped" one
>> =====================================================
>> <bean id="serviceFactory"
>> class="org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean">
>>   <property name="wrapped" value="false" />
>> </bean>
>> <bean id="clientFactoryBean"
>> class="org.apache.cxf.jaxws.JaxWsClientFactoryBean">
>>   <property name="serviceFactory" ref="serviceFactory" />
>>   <property name="serviceClass" value="com.rest.tryout.RestService" />
>> </bean>
>> <bean id="restServiceProxyFactory"
>> class="org.apache.cxf.jaxws.JaxWsProxyFactoryBean">
>>   <property name="clientFactoryBean" ref="clientFactoryBean" />
>>   <property name="address" value="${server.http.address}" />
>>   <property name="bindingId">
>>       <util:constant
>>
>> static-field="org.apache.cxf.binding.http.HttpBindingFactory.HTTP_BINDING_ID"
>> />
>>   </property>
>> </bean>
>>
>> <bean id="restServiceClient"
>>   class="com.rest.tryout.RestService"
>>   factory-bean="restServiceProxyFactory"
>>   factory-method="create" />
>> =====================================================
>>
>> I was mentionning the intricacy of this declaration, and I did this work
>> while still on 2.0.5, however I believe the Spring jaxrs bean declarations
>> still doesn't propose to set such properties.
>>
>>
>>
>>
>>> Cheers, Sergey
>>>
>>>
>>>
>>>> Thx in advance for your answers.
>>>>
>>>> Btw CXF is really a Great work :)
>>>>
>>>> --
>>>> Brice Dutheil
>>>>
>>>>
>>>>  ----------------------------
>>> IONA Technologies PLC (registered in Ireland)
>>> Registered Number: 171387
>>> Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland
>>>
>>>
>>
>>
>> --
>> Brice Dutheil
>>
>>
> ----------------------------
> IONA Technologies PLC (registered in Ireland)
> Registered Number: 171387
> Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland
>



-- 
Bryce

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message