camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Mindenhall <mark.mindenh...@machineshop.io>
Subject camel-netty4-http access to response
Date Tue, 17 Feb 2015 18:34:41 GMT
I’m using the camel-netty4-http (latest 2.14.2-SNAPSHOT) component to create an endpoint
that receives an HTTP POST from a device, translates the message from binary to JSON, then
sends it along to a kafka topic for further processing.  When there are errors in validating
or translating the incoming message, I need to be able to return a HTTP response code and
response body.

The camel-netty4-http documentation has an “Access to Netty types” section, which says
that I should be able to do the following to access the instance of io.netty.handler.codec.http.HttpResponse:

     HttpResponse response = exchange.getIn(NettyHttpMessage.class).getHttpResponse();

Regardless of where I access the exchange within the route, getHttpResponse() is always returning
null.  On the "happy path” I can return 200 by calling exchange.getOut().setBody(myResponse),
but I have been unable to figure out how to return another response code.

Is this a bug?  Or is there another way to accomplish what I’m trying to do?

Thanks,
Mark


Mime
View raw message