Hi Sergey,

Thank you! What version did you check in the fix? 2.2.5 or 2.3? Am I going
to download the snapshot version? 

Please advice. 

Best regards,
Allan


Sergey Beryozkin-2 wrote:
> 
> 
> Hi Allan
> 
> Sorry for a delay, I just fixed it. JAXBElementProvider was not checking
> for stax in/out factories, it was only checking for already 
> created readers/writers. There also was a minor issue to do with reading
> the fastinfoset on the client side
> 
> One thing I observed is that on the client side you do not need to
> @Consume fastinfoset explicitly given that a fastinfoset in 
> interceptor replaces it with text/xml.
> 
> thanks, Sergey
> 
>>
>>
>>
>> Hi Dan, Sergey,
>>
>> I added the Interceptors, but it's still not working. Here's my
>> implementation:
>>
>> first I added the interceptors:
>> <bean id="fastInfosetOutInterceptor"
>> class="org.apache.cxf.interceptor.FIStaxOutInterceptor" />
>> <bean id="fastInfosetInInterceptor"
>> class="org.apache.cxf.interceptor.FIStaxInInterceptor" />
>>
>> I applied it in my endpoint config:
>>
>> <jaxrs:server id="sampleService" address="/">
>> <jaxrs:serviceBeans>
>> <ref bean="sampleServiceBean" />
>> </jaxrs:serviceBeans>
>> <jaxrs:providers>
>> <ref bean="jaxbProvider" />
>> </jaxrs:providers>
>> <jaxrs:outInterceptors>
>> <ref bean="fastInfosetOutInterceptor" />
>> </jaxrs:outInterceptors>
>> <jaxrs:inInterceptors>
>> <ref bean="fastInfosetInInterceptor" />
>> </jaxrs:inInterceptors>
>> </jaxrs:server>
>>
>>
>> At first, threw an exception because "Content-Type" is not define. So I
>> added it in the request header. Then It went through
>> FIStaxOutInterceptor::handleMessage() fine, but the returned xml is still
>> not fastinfoset encoded.
>>
>> Did I miss something?
>>
>>
>> Thanks,
>> Allan
>>
>>
>>
>> dkulp wrote:
>>>
>>> On Tue January 19 2010 3:34:53 pm Sergey Beryozkin wrote:
>>>> Yes, that is probably it. Allan, can you try it ? I thought naively
>>>> @FastInfoset was handled at the runtime core level, but I will try to
>>>> update the JAXRS runtime to check for @FastInfoset and other newly
>>>> introduced annotations in time for 2.3
>>>
>>> The new annotations are handled by new listeners that listen for various
>>> events.   I have the ReflectionServiceFactoryBean producing those
>>> events.
>>> I
>>> haven't gone through the JAX-RS equivalent stuff yet to get those
>>> working.
>>> It
>>> shouldn't be hard, just needs to be done.
>>>
>>> Dan
>>>
>>>
>>>>
>>>> Cheers, Sergey
>>>>
>>>> -----Original Message-----
>>>> From: Daniel Kulp [mailto:[email protected]]
>>>> Sent: 19 January 2010 20:00
>>>> To: [email protected]
>>>> Cc: AllanSLim
>>>> Subject: Re: CXF 2.2.5 and Fastinfoset
>>>>
>>>>
>>>> Try configuring in the Fastinfoset interceptors directly.   I'm not
>>>> sure
>>>> if
>>>> the JAX-RS stuff will pickup the @FastInfoset annotation on 2.3 yet.
>>>>
>>>> Dan
>>>>
>>>> On Tue January 19 2010 1:19:45 pm AllanSLim wrote:
>>>> > Hi Sergey, Dan,
>>>> >
>>>> > I have tried it and it accepted it!  However, the xml output doesn't
>>>>
>>>> look
>>>>
>>>> > fastinfoset encoded. The xml output that I have is not big. Probably
>>>>
>>>> just
>>>>
>>>> >  10 lines.
>>>> >
>>>> >  To recap, here's what I have done (For other readers ):
>>>> >
>>>> > in my applicationContext.xml I added:
>>>> >
>>>> > <util:list id="customTypes">
>>>> > <value>application/xml</value>
>>>> > <value>application/fastinfoset</value>
>>>> > </util:list>
>>>> >
>>>> > <bean id="jaxbProvider"
>>>> > class="org.apache.cxf.jaxrs.provider.JAXBElementProvider">
>>>> > <property name="produceMediaTypes" ref="customTypes" />
>>>> > <property name="consumeMediaTypes" ref="customTypes" />
>>>> > </bean>
>>>> >
>>>> > and added a provider in my service:
>>>> >
>>>> > <!-- JAX-RS endpoint configuration -->
>>>> >   <jaxrs:server id="sampleService" address="/">
>>>> >     <jaxrs:serviceBeans>
>>>> >       <ref bean="sampleServiceBean" />
>>>> >     </jaxrs:serviceBeans>
>>>> >     <jaxrs:providers>
>>>> >     <ref bean="jaxbProvider" />
>>>> >     </jaxrs:providers>
>>>> >   </jaxrs:server>
>>>> >
>>>> >
>>>> > NOTE: The name space for util:list is needed. (
>>>> > xmlns:util="http://www.springframework.org/schema/util"; )
>>>> >
>>>> > Since I am using 2.3, I added the annotation in my service impl.
>>>> >
>>>> > @FastInfoset
>>>> > public class SampleServiceImpl implements SampleService {
>>>> >
>>>> >
>>>> >     @Path("/getSample")
>>>> >     @Produces({"application/xml","application/fastinfoset"})
>>>> >     public SampleResponse getSampleWithParams(@QueryParam("id") Long
>>>>
>>>> id)
>>>>
>>>> > throws SampleServiceException, SampleServiceIllegalArgumentException
>>>> {
>>>> >
>>>> >
>>>> >
>>>> > Thank you guys for the help!
>>>> >
>>>> >
>>>> > regards,
>>>> > Allan
>>>> >
>>>> > Sergey Beryozkin wrote:
>>>> > > Hi
>>>> > >
>>>> > > Sorry for a delay.
>>>> > > CXF JAXRS JaxbElementProvider is already checking for a custom
>>>> > > XMLStreamReader/XMLStreamWriter on a message, and if it is
>>>> available
>>>>
>>>> then
>>>>
>>>> > > will read from/write to it.
>>>> > > The current problem is that a JAXB  provider is not recognizing
>>>> > > "application/fastinfoset", so you just need to explicitly configure
>>>> > > JaxbElementProvider to accept
>>>> > >
>>>> > > "application/xml" and "application/fastinfoset", please see
>>>>
>>>> http://svn.apache.org/repos/asf/cxf/trunk/systests/jaxrs/src/test/resour
>>>> c
>>>>
>>>> > >es/jaxrs/WEB-INF/beans.xml
>>>> > >
>>>> > > ex, do something like
>>>> > >
>>>> > > <util:list id="customTypes">
>>>> > > <value>application/xml</value>
>>>> > > <value>application/fastinfoset</value>
>>>> > > </util:list>
>>>> > >
>>>> > > and then
>>>> > >
>>>> > > <bean id="jaxbProvider"
>>>> > > class="org.apache.cxf.jaxrs.provider.JAXBElementProvider">
>>>> > > <property name="produceMediaTypes" ref="customTypes"/>
>>>> > > <property name="consumeMediaTypes" ref="customTypes"/>
>>>> > > </bean>
>>>> > >
>>>> > > Can you try it please ? I hope this will work for you
>>>> > > Sergey
>>>> > >
>>>> > > AllanSLim wrote:
>>>> > >> Hi Dan,
>>>> > >>
>>>> > >> Thanks a lot! Any feedback from Sergey is also appreciated.
>>>> > >>
>>>> > >>
>>>> > >> We also have SOAP endpoints, I will experiment on that as well.
>>>> > >>
>>>> > >> regards,
>>>> > >> Allan
>>>> > >>
>>>> > >> dkulp wrote:
>>>> > >>> May need to wait till Sergey is back from his holidays for this.
>>>> > >>>
>>>> > >>> I don't think the FastInfosetFeature thing will work for JAX-RS
>>>> as
>>>>
>>>> that
>>>>
>>>> > >>> really
>>>> > >>> interacts with the StaxOutInterceptors that are used for the
>>>>
>>>> normal
>>>>
>>>> > >>> webservice
>>>> > >>> things.   What may be needed is a FI Provider thing for JAXRS.
>>>>
>>>> Not
>>>>
>>>> > >>> really
>>>> > >>> sure though.   Or maybe have the existing providers that use Stax
>>>> > >>> double check
>>>> > >>> the message for an XMLStreamReader or similar.      If I get a
>>>>
>>>> chance a
>>>>
>>>> > >>> bit
>>>> > >>> later, I'll try and take a look, but this is defintely closer to
>>>> > >>> Sergey's
>>>> > >>> area.
>>>> > >>>
>>>> > >>> Dan
>>>> > >>>
>>>> > >>> On Thu January 7 2010 11:32:34 am AllanSLim wrote:
>>>> > >>>> Hi Guys,
>>>> > >>>>
>>>> > >>>> We're trying to implementing  the fastInfoset feature of CXF
>>>>
>>>> (2.2.5)
>>>>
>>>> > >>>> in our
>>>> > >>>> REST service, but it's returning a 500 internal server error (
>>>> No
>>>> > >>>> message
>>>> > >>>> body writer has been found for response class Person ).
>>>> > >>>>
>>>> > >>>>  wget:
>>>> > >>>>
>>>> > >>>> wget -S --header="Accept: application/fastinfoset"
>>>> > >>>> http://localhost:8080/services/samples/getSample?id=9
>>>> > >>>>
>>>> > >>>> No message body writer has been found for response class Person
>>>> > >>>>
>>>> > >>>>
>>>> > >>>> Our rest service is:
>>>> > >>>>
>>>> > >>>> @Path("/samples")
>>>> > >>>> @Features(features = {
>>>>
>>>> "org.apache.cxf.feature.FastInfosetFeature" })
>>>>
>>>> > >>>> @Produces({"application/xml","application/fastinfoset",
>>>>
>>>> "text/plain"})
>>>>
>>>> > >>>> public class SampleServiceImpl implements SampleService {
>>>> > >>>>
>>>> > >>>>     @GET
>>>> > >>>>     @Path("/getPerson")
>>>> > >>>>     public Response getPerson() {
>>>> > >>>>         Person person = new Person();
>>>> > >>>>         person.setAge("99");
>>>> > >>>>         person.setName("Homer Simpson");
>>>> > >>>>         // trying the Response.ok()
>>>> > >>>>         return Response.ok(person).build();
>>>> > >>>>        // return person;
>>>> > >>>>     }
>>>> > >>>>
>>>> > >>>>
>>>> > >>>>
>>>> > >>>> Our class person is properly annotated with:
>>>> > >>>>
>>>> > >>>> @XmlRootElement(name = "Person")
>>>> > >>>> public class Person { .. }
>>>> > >>>>
>>>> > >>>>
>>>> > >>>>
>>>> > >>>> Our project is maven base.
>>>> > >>>>
>>>> > >>>> Any help will be greatly appreciated!
>>>> > >>>>
>>>> > >>>> Thank you very much!
>>>> > >>>>
>>>> > >>>> regards,
>>>> > >>>> Allan
>>>>
>>>
>>> -- 
>>> Daniel Kulp
>>> [email protected]
>>> http://www.dankulp.com/blog
>>>
>>>
>>
>> -- 
>> View this message in context:
>> http://old.nabble.com/CXF-2.2.5-and-Fastinfoset-tp27062753p27247240.html
>> Sent from the cxf-user mailing list archive at Nabble.com.
>> 
> 
> 
> 

-- 
View this message in context: 
http://old.nabble.com/CXF-2.2.5-and-Fastinfoset-tp27062753p27276089.html
Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to