camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ed Welch" ...@edjusted.com>
Subject Re: Rest DSL, HTTP_RESPONSE_CODE and bindings
Date Mon, 03 Aug 2015 12:28:22 GMT
Thanks Andy,

This worked great!

On Fri, 31 Jul 2015 00:12:30 -0500, Andrew Block <andy.block@gmail.com> wrote:

> 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 (ed@edjusted.com) 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



Mime
View raw message