Uploaded image for project: 'RESTEasy'
  1. RESTEasy
  2. RESTEASY-1232

FormParamInjector List<T>

    XMLWordPrintable

Details

    • Bug
    • Resolution: Won't Do
    • Major
    • None
    • 3.0.9.Final
    • jaxrs
    • Hide

      Defining a @PUT or @POST resource with a @FormParam like List<Long>, Restaeasy FormParamInjector injects List<String>

      Show
      Defining a @PUT or @POST resource with a @FormParam like List<Long>, Restaeasy FormParamInjector injects List<String>
    • Medium

    Description

      Environment: Jboss AS 7.1 + Restaeasy 3.0.9Final + JAX RS 2 + EJB 3

      Situation: @PUT resource with param like "@FormParam( "departmentId" ) List<Long> departmentIds"

      JEE API @FormParam Description says: " ... The type T of the annotated parameter must either:

      Be a primitive type
      Have a constructor that accepts a single String argument
      Have a static method named valueOf or fromString that accepts a single String argument (see, for example, Integer.valueOf(String))
      Be List<T>, Set<T> or SortedSet<T>, where T satisfies 2 or 3 above. The resulting collection is read-only.
      ..." -->
      https://docs.oracle.com/javaee/6/api/javax/ws/rs/FormParam.html

      Problem: FormParamInjector injects List<String> as param when it must be injected as List<Long> because Long has a constructor that accepts a single String argument.

      Attachments

        1. Junk6.java
          2 kB
        2. Longs.png
          Longs.png
          26 kB

        Activity

          People

            rsigal@redhat.com Ronald Sigal
            javigs82_jira Javier GS (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: