dev@jersey.java.net

HttpContext does not return the MediaType

From: exxos <hatufr_at_gmail.com>
Date: Tue, 7 Sep 2010 12:52:34 +0200

Hello,

Here is the code I'm testing:

@Path("hello")
public class App {

    @Context HttpContext httpContext;

    @GET
    @Produces(MediaType.TEXT_HTML)
    public Response getHtml() {

        System.out.println("RESOURCE hello >>> HttpContext Response:" +
httpContext.getResponse());
        System.out.println("RESOURCE hello >>> MediaType :" +
httpContext.getResponse().getMediaType());

       return Response.ok("Hello I'm fine !").build();
    }
}

The issue is that MediaType is "null". Could you please advise why I cannot
get the MediaType from the HttpContext?
(This is the same behavior with ExecptionMapper where I base content
negotiation on that)

Best regards,
exxos.