jersey
  1. jersey
  2. JERSEY-754

Multipart: Not possible have a collection as a parameter labled with @FormDataParam

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.8
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      FormDataMultiPartDispatchProvider drops parameters of type collection causing an exception Invalid Number of arguments when invoking the resource method.

      The collection generic type is match against FormDataBodyPart or FormDataContentDisposition and is otherwise dropped.

      We have custom serialisation of collections and it therefore legal to treat the content as other paramaters.

      if (Collection.class == p.getParameterClass() || List.class == p.getParameterClass()) {
      Class c = ReflectionHelper.getGenericClass(p.getParameterType());
      if (FormDataBodyPart.class == c)

      { list.add(new ListFormDataBodyPartMultiPartInjectable(p.getSourceName())); }

      else if (FormDataContentDisposition.class == c)

      { list.add(new ListFormDataContentDispositionMultiPartInjectable(p.getSourceName())); }

      // I recommend adding
      // } else

      { // list.add(new FormDataMultiPartParamInjectable(p)); // }

      }

        Activity

        Hide
        Jakub Podlesak added a comment -

        This has already been fixed. Should work for List<FormDataBodyPart> parameter type.

        Show
        Jakub Podlesak added a comment - This has already been fixed. Should work for List<FormDataBodyPart> parameter type.

          People

          • Assignee:
            Jakub Podlesak
            Reporter:
            dynaheir
          • Votes:
            2 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: