Ed,

You can set the skipBindingModeOnErrorCode option to false to leverage the 
existing binding configuration.

- Andy

-- 
Andrew Block


On July 30, 2015 at 4:21:00 PM, Ed Welch ([email protected]) wrote:

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

Reply via email to