You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by vathsan <sr...@yahoo.com> on 2008/10/30 19:25:51 UTC

Using FastInfoset with CXF

It appears that FastInfoset has some performance benefits and I've been
trying to find examples of how to employ it but haven't found any yet.
Anyone here come across an example of how to make use of FastInfoset with
CXF?
General guidelines on its usage will also be helpful. Thanks.
-- 
View this message in context: http://www.nabble.com/Using-FastInfoset-with-CXF-tp20252695p20252695.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: Using FastInfoset with CXF

Posted by AllanSLim <be...@yahoo.com>.

Hi Dan,

For some reason, I cannot make this work. I added the annotation, and when I
do wget with accept = application/fastinfoset, it returns a 500 internal
server error.

wget -S --header="Accept: application/fastinfoset"
http://localhost:8080/services/samples/getSample

We are using CXF 2.2.5 and our project is maven base. any advice will be
greatly appreciated.

our service is design this way:

@Path("/samples")
@Features(features = { "org.apache.cxf.feature.FastInfosetFeature" })
@Produces({"application/xml","application/fastinfoset", "text/plain"})
public class SampleServiceImpl implements SampleService {


best regards,
Allan


dkulp wrote:
> 
> On Thursday 30 October 2008 2:25:51 pm vathsan wrote:
>> It appears that FastInfoset has some performance benefits and I've been
>> trying to find examples of how to employ it but haven't found any yet.
>> Anyone here come across an example of how to make use of FastInfoset with
>> CXF?
>> General guidelines on its usage will also be helpful. Thanks.
> 
> The easiest is probably add:
> @Features(features = { "org.apache.cxf.feature.FastInfosetFeature" })
> to the interface if this is a code-first thing.   
> 
> 
> Otherwise, bus level config is pretty easy:
> 
>     <bean id="fastinfoset"
> class="org.apache.cxf.feature.FastInfosetFeature"/>
>     <cxf:bus>
>         <cxf:features>
>             <ref bean="fastinfoset"/>
>         </cxf:features>
>     </cxf:bus>
> 
> The FastInfosetFeature bean has a property to "force" usage of FastInfoset
> if 
> you need to do that.   However, the default usually works pretty well as
> it 
> ends up being a negotiated thing.   The first request from a client 
> is "normal", but adds a fastinfoset thing to the Accept-Content-Type.   If 
> the server side sees that, it responsds with fastinfoset.   From there on, 
> the client knows the server is OK with that and will send all subsequent 
> requests with fastinfoset.   
> 
> 
> -- 
> Daniel Kulp
> dkulp@apache.org
> http://dankulp.com/blog
> 
> 

-- 
View this message in context: http://old.nabble.com/Using-FastInfoset-with-CXF-tp20252695p27026983.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: Using FastInfoset with CXF

Posted by AllanSLim <be...@yahoo.com>.


Hi guys,

I added that annotation, in my application, and when i view the (rest)
endpoint in a browser, it didn't do anything. I checked the accept variable
in the Request Header (using firebug), it didn't say "text/fastinfoset".  Is
there anything that I am missing? I'm using CXF 2.2.5, and my project is
maven based.

Am I supposed to see a garbage data when viewing the endpoint that is
binarily encoded?

Any advice, will be greatly appreciated.

Thanks,
Allan



dkulp wrote:
> 
> On Thursday 30 October 2008 2:25:51 pm vathsan wrote:
>> It appears that FastInfoset has some performance benefits and I've been
>> trying to find examples of how to employ it but haven't found any yet.
>> Anyone here come across an example of how to make use of FastInfoset with
>> CXF?
>> General guidelines on its usage will also be helpful. Thanks.
> 
> The easiest is probably add:
> @Features(features = { "org.apache.cxf.feature.FastInfosetFeature" })
> to the interface if this is a code-first thing.   
> 
> 
> Otherwise, bus level config is pretty easy:
> 
>     <bean id="fastinfoset"
> class="org.apache.cxf.feature.FastInfosetFeature"/>
>     <cxf:bus>
>         <cxf:features>
>             <ref bean="fastinfoset"/>
>         </cxf:features>
>     </cxf:bus>
> 
> The FastInfosetFeature bean has a property to "force" usage of FastInfoset
> if 
> you need to do that.   However, the default usually works pretty well as
> it 
> ends up being a negotiated thing.   The first request from a client 
> is "normal", but adds a fastinfoset thing to the Accept-Content-Type.   If 
> the server side sees that, it responsds with fastinfoset.   From there on, 
> the client knows the server is OK with that and will send all subsequent 
> requests with fastinfoset.   
> 
> 
> -- 
> Daniel Kulp
> dkulp@apache.org
> http://dankulp.com/blog
> 
> 

-- 
View this message in context: http://old.nabble.com/Using-FastInfoset-with-CXF-tp20252695p27016204.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: Using FastInfoset with CXF

Posted by Daniel Kulp <dk...@apache.org>.
On Thursday 30 October 2008 2:25:51 pm vathsan wrote:
> It appears that FastInfoset has some performance benefits and I've been
> trying to find examples of how to employ it but haven't found any yet.
> Anyone here come across an example of how to make use of FastInfoset with
> CXF?
> General guidelines on its usage will also be helpful. Thanks.

The easiest is probably add:
@Features(features = { "org.apache.cxf.feature.FastInfosetFeature" })
to the interface if this is a code-first thing.   


Otherwise, bus level config is pretty easy:

    <bean id="fastinfoset" class="org.apache.cxf.feature.FastInfosetFeature"/>
    <cxf:bus>
        <cxf:features>
            <ref bean="fastinfoset"/>
        </cxf:features>
    </cxf:bus>

The FastInfosetFeature bean has a property to "force" usage of FastInfoset if 
you need to do that.   However, the default usually works pretty well as it 
ends up being a negotiated thing.   The first request from a client 
is "normal", but adds a fastinfoset thing to the Accept-Content-Type.   If 
the server side sees that, it responsds with fastinfoset.   From there on, 
the client knows the server is OK with that and will send all subsequent 
requests with fastinfoset.   


-- 
Daniel Kulp
dkulp@apache.org
http://dankulp.com/blog