You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by gquintana <ge...@gmail.com> on 2014/09/16 12:22:00 UTC

JAXRS Client proxy and StreamingOutput

Hello,

I have a JAXRS service described as:


When I try to invoke it using a client proxy, I get an error: /No message
body reader has been found for class : interface
javax.ws.rs.core.StreamingOutput, ContentType : application/pdf/ . When I
replace StreamingOutput by byte[] it works, but I would prefer to stream the
output as much as I can.

Do I need to register some JAXRS data provider? Looking at the
BinaryDataProvider source code, it should support the StreamingOuput class,
I tried something like the following without success:



What's wrong?

Gérald


Detailed stack trace:




--
View this message in context: http://cxf.547215.n5.nabble.com/JAXRS-Client-proxy-and-StreamingOutput-tp5748764.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: JAXRS Client proxy and StreamingOutput

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi
On 17/09/14 07:53, gquintana wrote:
> I replaced in the method signature StreamingOuput by InputStream, it seems to
> work. Yet I don't know whether there is a difference internally.
AFAIK using StreamingOutput on the server side can make a difference if 
the code does flush() after every write() - this should lead to the 
client seeing the bytes as soon as they become available.

When it is a utility copy of InputStream to OutputStream then I guess 
(Dan or Aki are the experts) what happens that some sort of streaming 
can occur, once an out threshold is reached and the chunked encoding 
gets activated...

Cheers, Sergey

>
> Gérald
>
>
>
> --
> View this message in context: http://cxf.547215.n5.nabble.com/JAXRS-Client-proxy-and-StreamingOutput-tp5748764p5748817.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>


Re: JAXRS Client proxy and StreamingOutput

Posted by gquintana <ge...@gmail.com>.
I replaced in the method signature StreamingOuput by InputStream, it seems to
work. Yet I don't know whether there is a difference internally.

Gérald



--
View this message in context: http://cxf.547215.n5.nabble.com/JAXRS-Client-proxy-and-StreamingOutput-tp5748764p5748817.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: JAXRS Client proxy and StreamingOutput

Posted by gquintana <ge...@gmail.com>.
Created issue https://issues.apache.org/jira/browse/CXF-6006
Thanks for advice.

Gérald



--
View this message in context: http://cxf.547215.n5.nabble.com/JAXRS-Client-proxy-and-StreamingOutput-tp5748764p5748799.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: JAXRS Client proxy and StreamingOutput

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi
On 16/09/14 11:22, gquintana wrote:
> Hello,
>
> I have a JAXRS service described as:
>
>
> When I try to invoke it using a client proxy, I get an error: /No message
> body reader has been found for class : interface
> javax.ws.rs.core.StreamingOutput, ContentType : application/pdf/ . When I
> replace StreamingOutput by byte[] it works, but I would prefer to stream the
> output as much as I can.
>
> Do I need to register some JAXRS data provider? Looking at the
> BinaryDataProvider source code, it should support the StreamingOuput class,
> I tried something like the following without success:
>
It supports it on the write side only for now. Typically, on the client 
side, one can get Response InputStream and read from it. Perhaps there's 
a case there for supporting it on the read side too, in the proxy case, 
given that StreamingOutput is in the signature and simply for the 
application code not to deal with a "read from Input Stream, write to 
OutputStream" itself...

Can you please open a CXF enhancement request ?
And in meantime, create a custom MBR which supports StreamingOutput only 
and register it with jaxrs:providers

Cheers, Sergey
>
>
> What's wrong?
>
> Gérald
>
>
> Detailed stack trace:
>
>
>
>
> --
> View this message in context: http://cxf.547215.n5.nabble.com/JAXRS-Client-proxy-and-StreamingOutput-tp5748764.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>