You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Claus Ibsen (Jira)" <ji...@apache.org> on 2021/08/29 14:20:00 UTC

[jira] [Resolved] (CAMEL-16896) Message.getHeader() doesn't convert Expression to requested type

     [ https://issues.apache.org/jira/browse/CAMEL-16896?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen resolved CAMEL-16896.
---------------------------------
    Resolution: Not A Bug

This is by design.

> Message.getHeader() doesn't convert Expression to requested type
> ----------------------------------------------------------------
>
>                 Key: CAMEL-16896
>                 URL: https://issues.apache.org/jira/browse/CAMEL-16896
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 3.7.5, 3.11.0
>            Reporter: Karen Lease
>            Assignee: Karen Lease
>            Priority: Major
>              Labels: pull-request-available
>
> [~onders] reported an issue when setting a header in a Processor with a constant value, like this:
> {code:java}
> from("direct:uploadFiles")
>         .process(new Processor() {
>             @Override
>             public void process(Exchange exchange) throws Exception {exchange.getIn().setHeader(Exchange.HTTP_RESPONSE_CODE,
> constant(500));
>             }
>         });
> {code}
> This was invoked from a rest() route and was expected to return HTTP 500 but did not.
> The reason is that the DefaultHttpBinding calls getHeader(Exchange.HTTP_RESPONSE_CODE, Integer.class) but the value in the Exchange header is a ValueBuilder and not an Integer.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)