Do you do a single write with
mapper.writeValue(writer.getEntityStream(), result);
Can you also write it to stdout to check ?
If you do multiple writes then use Writer to wrap it all as an array
SErgey
On 24/07/15 17:33, Benson Margulies wrote:
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 <[email protected]> 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
--
Sergey Beryozkin
Talend Community Coders
http://coders.talend.com/
Blog: http://sberyozkin.blogspot.com