jersey
  1. jersey
  2. JERSEY-1699

Return type GenericEntity passes unexpected GenericType to MessageBodyWriter

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Blocker Blocker
    • Resolution: Duplicate
    • Affects Version/s: 2.0-m12
    • Fix Version/s: 2.0-rc1, 2.0
    • Component/s: core
    • Labels:
      None

      Description

      Spec. Section 3.3.3 says:

      The return type of a resource method and the type of the returned instance are used to determine the
      raw type and generic type supplied to the isWritable method of MessageBodyWriter as follows:

      Return Type Returned Instance Raw Type Generic Type
      GenericEntity GenericEntity<List<String>> ArrayList<?> List<String>

      but resource method:

      	@Path("genericentity/linkedlist")
      	@GET
      	public GenericEntity<LinkedList<String>> checkGeneric() {
      		LinkedList<String> list = new LinkedList<String>();
      		list.add("linked");
      		list.add("list");
      		GenericEntity<LinkedList<String>> gells;
      		gells = new GenericEntity<LinkedList<String>>(list, List.class);
      		return gells;
      	}
      

      will pass to MessageBodyWriter<Collection<?>>#isWritable(Class<?> type, Type genericType,
      Annotation[] annotations, MediaType mediaType)
      genericType == javax.ws.rs.core.GenericEntity<java.util.LinkedList<java.lang.String>>

        Issue Links

          Activity

          Hide
          Miroslav Fuksa added a comment - - edited

          duplicate to JERSEY-1563: these issues describe the same problem.

          Show
          Miroslav Fuksa added a comment - - edited duplicate to JERSEY-1563 : these issues describe the same problem.
          Hide
          Miroslav Fuksa added a comment -

          closing as a duplication to jersey-1563 which is fixed.

          Show
          Miroslav Fuksa added a comment - closing as a duplication to jersey-1563 which is fixed.

            People

            • Assignee:
              Miroslav Fuksa
              Reporter:
              jan.supol
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: