Uploaded image for project: 'Wink'
  1. Wink
  2. WINK-262

Content-Type of HTTP Response contains no charset.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.0
    • 1.1
    • Server
    • Jetty Server 6.1

    Description

      I have the following handler:

      import javax.ws.rs.GET;
      import javax.ws.rs.Path;
      import javax.ws.rs.Produces;
      import javax.ws.rs.core.Context;
      import javax.ws.rs.core.MediaType;
      import javax.ws.rs.core.Request;
      import javax.ws.rs.core.Response;
      
      import org.apache.wink.common.model.atom.AtomEntry;
      import org.apache.wink.common.model.atom.AtomText;
      
      @Path("contentType")
      public class ContentTypeTest {
      	@GET
      	@Produces( { MediaType.APPLICATION_XML, MediaType.TEXT_XML, MediaType.APPLICATION_JSON, "text/javascript" })
      	public Response getRepresentation(@Context Request req) {
      		AtomEntry e = new AtomEntry();
      		e.setTitle(new AtomText(
      				"\u5341\u5341\u5341\u5341\u5341\u5341\u5341\u5341\u5341\u5341\u5341\u5341\u4e00\u69cb\u30bd\u30c1\u2010"));
      		return Response.ok(e).build();
      	}
      }
      

      When I open the resource I get the following HTTP response:

      Content-Type:	application/xml
      Content-Length:	274
      Server:	Jetty(6.1.x)
      

      You can see that the charset is not specified and the content is not properly decoded e.g. by RestClient - http://code.google.com/p/rest-client/

      However I can see that the XML is properly encoded by opening the resource in FF and enforcing UTF-8 decoding.

      Shouldn't wink put the encoding used during serialization if different than ASCII?

      Attachments

        1. WINK-262.patch
          12 kB
          Michael Rheinheimer
        2. WINK-262-2.patch
          47 kB
          Bryant Luk

        Activity

          People

            rott Michael Rheinheimer
            kkolev Kaloyan Kolev
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: