you should use HttpContext.getRequest(); response doesn't exists when
you are asking for it.
On 9/7/10 1:03 PM, exxos wrote:
> 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.