Hi,
I can write:
@GET
@Produces(MediaType.TEXT_PLAIN + ", " + MediaType.TEXT_HTML)
public Response read(@HeaderParam("Accept") String accept) {
System.out.println("I was here");
if (accept == MediaType.TEXT_PLAIN) {
return Response.status(Status.OK).entity("text").type(MediaType.TEXT_PLAIN).build();
} else {
return Response.status(Status.OK).entity("<html><body>text</body></html>").type(MediaType.TEXT_HTML).build();
}
}
My question was: is this accept implicit?
Thanx
Robert
2009/12/4 Paul Sandoz <Paul.Sandoz_at_sun.com>:
>
> On Dec 4, 2009, at 4:18 PM, Robert Naczinski wrote:
>
>> Hello,
>>
>> I can annotate resource method with '_at_Produces'-Annotation
>> (https://jsr311.dev.java.net/nonav/releases/1.1/javax/ws/rs/Produces.html)
>> In this annotation you can have one or several values.
>>
>> Can I automatically get this value of HTTP Header?
>>
>> With @HeaderParam can I get this value. But can I get this implicit?
>>
>
> I do not understand what you mean. Can you provide a concrete example of
> what to want to do?
>
> Paul.
>
>> Is there 'Best Practice'?
>>
>> Thanks
>> Robert
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
>> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>
>