cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Benson Margulies <ben...@basistech.com>
Subject Re: Need help with a StreamingResponse
Date Fri, 24 Jul 2015 14:33:51 GMT
Registering it got it to 'work', but the resulting Json is garbled;
it's json, but part of it is repeated inside of itself in a way that I
can't explain. I'm going to retreat to StreamOutput and see what I
see.


On Fri, Jul 24, 2015 at 10:21 AM, Sergey Beryozkin <sberyozkin@gmail.com> wrote:
> Register org.apache.cxf.jaxrs.provider.StreamingResponseProvider,
> StreamingResponse is a CXF extension hence it is not supported by default,
>
> Cheers, Sergey
>
> On 24/07/15 17:16, Benson Margulies wrote:
>>
>> When this gets called, the result on the wire is:
>>
>> No message body writer has been found for class
>> com.basistech.raas.annotatorservice.AnnotatorService$2, ContentType:
>> application/json
>>
>> I must be missing something simple.
>>
>>
>>
>> @POST
>> @Produces("application/json")
>> @Consumes(MediaType.TEXT_PLAIN)
>> @Path("annotatePlain")
>> public StreamingResponse<AnnotatedText> annotatePlain(String text)
>> throws IOException, RosetteException {
>>      AnnotatedText inputText = new
>> AnnotatedText.Builder().data(text).build();
>>      final AnnotatedText result =
>> pipeline.createAnnotator().annotate(inputText);
>>      return new StreamingResponse<AnnotatedText>() {
>>          @Override
>>          public void writeTo(Writer<AnnotatedText> writer) throws
>> IOException {
>>              mapper.writeValue(writer.getEntityStream(), result);
>>          }
>>      };
>> }
>>
>
>
> --
> Sergey Beryozkin
>
> Talend Community Coders
> http://coders.talend.com/
>
> Blog: http://sberyozkin.blogspot.com

Mime
View raw message