Support Jersey file upload
yissachar opened this issue · 5 comments
I am trying to use @GenRestBuilder
on an API that uses Jersey multipart data for file upload. The annotation processor fails with the exception
Cannot have more than one body parameter
My method looks like the following:
@POST
@Path("/upload")
@Consumes(MediaType.MULTIPART_FORM_DATA)
public void upload(@FormDataParam("file") InputStream stream,
@FormDataParam("file") FormDataContentDisposition fileDetail {
// do something
}
The ideal would be if multipart data upload could be supported by the generator, but if that's not possible it would be nice if I could tell the annotation processor to ignore this method. I have many other methods in this file that I would like to generate but the exception stops the generation for those methods as well.
I don't think I can easily generate the request. I would need another annotation to specify what class to use instead of InputStream for example. Maybe you are using a byte[] or a JSO for the HTML5 File API.
Is it ok if I just log a warning/error but continue the generation or you prefer a specific annotation to add on the method ?
Or maybe you have a suggestion to implement the multipart on client side ?
I don't have any suggestion for how to implement the multipart request. It's not actually super important for me - I can just use a form to upload the data.
Logging a warning/error and continuing the generation would be great.
@GenRestIgnore
works well for my code.
I released a 0.3.0 version.