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

content-type not automatically set for methods returning Response

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • Beta 9
    • Beta 8
    • None
    • None

      Hi,

      I'm having a problem when using the Response class. The following code
      worked in 1.0-beta-5 version but no longer works after upgrading to
      1.0-beta-8. The only change i made from the beta-5 version to beta-8
      version is changing the @ProduceMime to @Produces. The beta-5 version
      would create an xml representation of the Protocol class, which contains
      jaxb annotations. However, the beta-8 version no longer creates the xml
      representation, it just returns a simple string that looks something
      like this, "Protocol@1253dfb". What do i need to change to get this to
      work in the beta-8 version?

      Thanks,
      Todd

      @GET
      @Path("protocol/

      {id}

      ")
      @Produces("application/xml")
      public Response getProtocol(@PathParam("id") Long id);

      public Response getProtocol(Long id) {

      Response response;

      Protocol entity = protocolDAO.findById(id);

      if (entity != null)

      { response = Response.ok(entity).build(); }

      else

      { response = Response.serverError().build(); }

      return response;
      }

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

              Created:
              Updated:
              Resolved: