Hi Benson
I see WADLGenerator restricting that only simple or InputStream types are recognized as multipart parameters, I can deal with it next week once I got back, though the best you'll get is a WADL request representation fragment with two parameters of type xs:anyType in this case

Cheers, Sergey
On 29/07/15 21:07, Benson Margulies wrote:
<application xmlns="http://wadl.dev.java.net/2009/02";
xmlns:xs="http://www.w3.org/2001/XMLSchema";>
<grammars/>
<resources base="http://192.168.59.103:8181/cxf/annotator";>
<resource path="/">
<resource path="annotate">
<method name="POST">
<request>
<representation mediaType="multipart/mixed">
<param name="text" style="query" type="xs:anyType"/>
</representation>
</request>
<response>
<representation mediaType="application/json"/>
<representation mediaType="application/x-jackson-smile"/>
</response>
</method>
</resource>
<resource path="annotatePlain">
<method name="POST">
<request>
<representation mediaType="text/plain">
<param name="request" style="plain" type="xs:string"/>
</representation>
</request>
<response>
<representation mediaType="application/json"/>
</response>
</method>
</resource>
</resource>
</resources>
</application>

On Wed, Jul 29, 2015 at 2:07 PM, Benson Margulies <ben...@basistech.com> wrote:
Here's the perplexing wadl...

On Wed, Jul 29, 2015 at 2:03 PM, Benson Margulies <ben...@basistech.com> wrote:
The WADL for this shows only one parameter. Did I miss something?


@POST
@Consumes("multipart/mixed")
@Produces({"application/json", "application/x-jackson-smile"})
@Path("annotate")
public Response annotate(
     @Multipart(value = "options", type = "application/json")
     Map<String, String> options,
     @Multipart(value = "text") InputStream text) throws IOException,
RosetteException {

     final ObjectMapper mapper = getMapper();
     AnnotatedText inputText = mapper.readValue(text, AnnotatedText.class);
     final AnnotatedText result = 
pipeline.createAnnotator().annotate(inputText);

     StreamingOutput stream = new StreamingOutput() {
         @Override
         public void write(OutputStream os) throws IOException,
WebApplicationException {
             mapper.writeValue(os, result);
         }
     };
     return Response.ok(stream).build();
}

Reply via email to