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

Reply via email to