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

application/json;charset=utf-8 unmarshalling problem with JAXB

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Obsolete
    • Icon: Minor Minor
    • None
    • 1.2.GA, 1.2.1.GA
    • None
    • None
    • Hide

      A poor workaround is to use XML instead of JSON

      Show
      A poor workaround is to use XML instead of JSON
    • Medium

      I've tested two remote methods :

      @GET
      @Path("/getprofile/

      {id}")
      @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
      ClientProfile getClientProfile(@PathParam("id") Integer id);

      @GET
      @Path("/getprofile2/{id}

      ")
      @Produces(

      {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}

      )
      List<ClientProfile> getClientProfile2(@PathParam("id") Integer id);

      The second one only wraps result of the first. The content type of resposne is "application/json;charset=utf-8". After unmarshalling in client the first one gives me utf-8 encoding issues in text properties while the second one gives me correct result. It looks like JAXBXmlRootElementProvider doesn't use proper charset in the first example while, ran in JsonCollectionProvider - works fine. In debugger MediaType looks to be passed the same way both times.

      If I change JSON to XML marshalling like this : @Produces(

      {MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}

      ) both methods work fine.

            patriot1burke@gmail.com Bill Burke (Inactive)
            peper_jira Peter Gwiazda (Inactive)
            Votes:
            2 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: