I have a JAX-RS webservice using Jersey-1. There is only a single method at the moment, which sends mails with attachment. The attachment has to be provided as a multipart form data.
@POST
@Path("/mail")
@Consumes(MediaType.MULTIPART_FORM_DATA)
public Response sendInfomailWithAttachment(
@Context ServletContext context,
@Context SecurityContext security,
@QueryParam ("FROM") String senderAddress,
@QueryParam ("SUBJECT") String subject,
@QueryParam ("TO") String toRecipients,
@QueryParam ("CC") String ccRecipients,
@QueryParam ("BCC") String bccRecipients,
@QueryParam ("noCopy") boolean sendNoCopy,
@FormDataParam("attachment") InputStream fileInputStream,
@FormDataParam("attachment") FormDataContentDisposition contentDispositionHeader,
@FormDataParam("attachment") FormDataBodyPart fileBody,
@FormDataParam("content") FormDataBodyPart content
){}
The method works fine. But when I try to integrate swagger, I always get this error(s):
SEVERE: Missing dependency for method public javax.ws.rs.core.Response ... throws java.lang.Exception at parameter at index 8
(this error is thrown for param 9, 10 and 11 as well)
in combination with
SEVERE: Method, public javax.ws.rs.core.Response ... throws java.lang.Exception, annotated with POST of resource, class com.mywebservice.MyClass, is not recognized as valid resource method.
If I throw out the FormDataParam stuff, the service starts normally, also with the swagger integration.
I use
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.3</version>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-servlet</artifactId>
<version>1.17</version>
</dependency>
<dependency>
<groupId>com.sun.jersey.contribs</groupId>
<artifactId>jersey-multipart</artifactId>
<version>1.17</version>
</dependency>
and
<dependency>
<groupId>com.wordnik</groupId>
<artifactId>swagger-jersey-jaxrs_2.10</artifactId>
<version>1.3.4</version>
</dependency>
Is there any known interference? Anything else I could do to come around this?