camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ed Welch" ...@edjusted.com>
Subject Rest DSL, HTTP_RESPONSE_CODE and bindings
Date Thu, 30 Jul 2015 21:20:50 GMT
I'm trying to send a 400 response back to the client, however, I want to send the same body
type as registered with outType.

The docs around customer error messages say:

In the UserErrorService bean we build our custom error message, and set the HTTP error code
to 400. This is important, as that tells rest-dsl that this is a custom error message, and
the message should not use the output pojo binding (eg would otherwise bind to CountryPojo).

So when I set:

exchange.getIn().setHeader(Exchange.HTTP_RESPONSE_CODE, 400);

That tells the rest-dsl to not use the output pojo binding.

Except that's exactly what I want it to do.  

Is there a way to return a 400+ response code AND keep the rest binding mode behavior as if
it were a 200?

Thanks!
Ed
Mime
View raw message