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 2023/03/25 08:56:00 UTC

[jira] [Comment Edited] (CAMEL-19077) Not able to get HttpMessage from exchange after HttpCopoment

    [ https://issues.apache.org/jira/browse/CAMEL-19077?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17704910#comment-17704910 ] 

Claus Ibsen edited comment on CAMEL-19077 at 3/25/23 8:55 AM:
--------------------------------------------------------------

Ah yeah HttpMessage is created on the consumer side only (currently) eg servlet / jetty etc.

The servlet request/response is ONLY for servlets, not http clients. So you cannot have them here.


was (Author: davsclaus):
Ah yeah HttpMessage is created on the consumer side only (currently) eg servlet / jetty etc

> Not able to get HttpMessage  from exchange after HttpCopoment
> -------------------------------------------------------------
>
>                 Key: CAMEL-19077
>                 URL: https://issues.apache.org/jira/browse/CAMEL-19077
>             Project: Camel
>          Issue Type: Bug
>          Components: came-core
>    Affects Versions: 3.20.1, 3.20.2, 3.x
>            Reporter: WangYan
>            Priority: Major
>
> I open this as bug ticket 
> according to suggestion from [(3442) #camel > How to get HttpRequest and HttpReponse from exchange - camel - Zulip (zulipchat.com)|https://camel.zulipchat.com/#narrow/stream/257298-camel/topic/How.20to.20get.20HttpRequest.20and.20HttpReponse.20from.20exchange] 
>  
>  
>  
> *Problem:* 
> Not able to get HttpMessage  from exchange after HttpCopoment
> I used debugger it shows message Tpye is JMSMessage instead of HttpMessage
>  
>  
> *Example Code:* 
>         from("jms:topic:\{{my.topicname}}")
>                 .to("direct:restendpoint");
>         from("direct:restendpoint").routeId("direct_restendpoint")
>                 .to("https://<URL_SERVICE>")
>                 .process(exchange -> {
>                     String responseCode = exchange.getIn().getHeader("CamelHttpResponseCode").toString();
>                     //responseCode is 200
>                     LOG.info("responseCode->{}",responseCode);
>                     // httpMessages are all NULL
>                     LOG.info("httpMessage1->{}",exchange.getIn(org.apache.camel.http.common.HttpMessage.class));
>                     LOG.info("httpMessage2->{}",exchange.getIn(org.apache.http.HttpMessage.class));
>                     LOG.info("httpMessage3->{}",exchange.getIn(io.netty.handler.codec.http.HttpMessage.class));
>                     LOG.info("httpMessage4->{}",exchange.getIn(org.springframework.http.HttpMessage.class));
>                 }
>  
> *Affected version* 
> I tried 3.11.2 & 3.20.2 assumption it is for all 3.x 
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)