You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by "Vjacheslav V. Borisov" <sl...@gmail.com> on 2018/08/10 08:47:46 UTC

How to determine served content-type?

Hi!

When method serves different content-types, like

@Produces({"application/xml", "application/json", "application/xhtml+xml" })

How to determine served content-type?

Should I manually parse "Accept" header

        Message message = PhaseInterceptorChain.getCurrentMessage();
        message.get("Accept");


or  can I get this information from cxf runtime?

Re: How to determine served content-type?

Posted by Alexey Markevich <am...@talend.com>.
Hi,

Try
void method(@HeaderParam(HttpHeaders.CONTENT_TYPE) String contentType, ...)

On Fri, 10 Aug 2018 11:47:46 +0300, Vjacheslav V. Borisov
<sl...@gmail.com> wrote:

> Hi!
>
> When method serves different content-types, like
>
> @Produces({"application/xml", "application/json",
> "application/xhtml+xml" })
>
> How to determine served content-type?
>
> Should I manually parse "Accept" header
>
>         Message message = PhaseInterceptorChain.getCurrentMessage();
>         message.get("Accept");
>
>
> or  can I get this information from cxf runtime?


--
Regards, Alexey.
As a recipient of an email from Talend, your contact personal data will be on our systems. Please see our contacts privacy notice at Talend, Inc. <https://www.talend.com/contacts-privacy-policy/>