users@jersey.java.net

Re: [Jersey] Jersey Multipart / Missing Dependencies

From: Paul Sandoz <Paul.Sandoz_at_oracle.com>
Date: Tue, 24 Aug 2010 12:30:08 +0200

Hi Stefan,

I just wrote a quick test with the trunk using the same method
signature and it works fine for me.

Are you ensuring that all jersey modules are of the same version?

Can you share the jersey dependencies?

The error implies that the special multipart method processor that
detects for @FormDataParam is not working correctly for that method
signature. However, looking at code that detects such methods i do not
see how removing one of the @FormDataParam annotated parameters will
make any difference:

         boolean hasFormParam = false;
         for (int i = 0; i < method.getParameters().size(); i++) {
             Parameter parameter = method.getParameters().get(i);
             if (parameter.getAnnotation() != null)
                 hasFormParam |=
parameter.getAnnotation().annotationType() == FormDataParam.class;
         }
         if (!hasFormParam)
             return null;


Paul.

On Aug 23, 2010, at 5:33 PM, Stefan Heinz wrote:

> Hello!
> I'm using jersey-multipart to process form data.
>
> @Path("/form")
> @POST
> @Consumes(MediaType.MULTIPART_FORM_DATA)
> public Response postFileByForm(@FormDataParam("file") InputStream in,
> @Inject DataBaseService service,
> @FormDataParam("file") FormDataContentDisposition contentDisp) {
> ...
>
> After having switched the multipart version in maven back from 1.4-
> xxx to 1.3 this works fine in Tomcat. My unit tests use the jersey-
> test-framwork with grizzly and there the same error occurs as with
> 1.4-xxx before:
> Having both @FormDataParams (i.e. InputStream AND
> FormDataContentDisposition) results in
>
> SCHWERWIEGEND: The following errors and warnings have been detected
> with resource and/or provider classes:
> SEVERE: Missing dependency for method public
> javax
> .ws
> .rs
> .core
> .Response
> ....postFileByForm
> (java
> .io
> .InputStream
> ,....DataBaseService
> ,com.sun.jersey.core.header.FormDataContentDisposition) at parameter
> at index 0
> SEVERE: Missing dependency for method public
> javax
> .ws
> .rs
> .core
> .Response
> ....postFileByForm
> (java
> .io
> .InputStream
> ,....DataBaseService
> ,com.sun.jersey.core.header.FormDataContentDisposition) at parameter
> at index 2
>
> The strange thing is I can keep ONE of the two FormDataParams and
> everything works fine, but with both I get these errors.
>
> Does anybody have any idea what goes wrong here?
>
> Thanks in advanve,
> Stefan
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>