camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Remco Schoen <>
Subject Re: No HTTP response when using onException with BeanValidationException
Date Sat, 15 Oct 2016 15:14:29 GMT

I did a little more testing and found that there seems to be a conflict in the headers.

When I add this to the XML it works:
<removeHeaders pattern="*”/>

I printed the headers, maybe that gives a clue.

{Accept=application/json, Accept-Encoding=gzip, deflate, Accept-Language=nl-nl, breadcrumbId=51099-1476544028839-0-2,
CamelHttpCharacterEncoding=UTF-8, CamelHttpMethod=POST, CamelHttpPath=, CamelHttpQuery=null,
CamelHttpServletRequest=Request(POST /custom_webapi/hello/world)@13b615ae, CamelHttpServletResponse=HTTP/1.1

, CamelHttpUri=/custom_webapi/hello/world, CamelHttpUrl=http://remco.local:8080/custom_webapi/hello/world,
CamelServletContextPath=/custom_webapi/hello/world, Connection=keep-alive, Content-Length=3,
Content-Type=application/json, Host=remco.local:8080, Origin=, Referer=,

That would explain why in some cases it works, the request was already routed to another webserver,
so the headers were already changed before the exception.


Met vriendelijke groet,

Remco Schoen

Op 14 okt. 2016, om 16:36 heeft Remco Schoen <<>>
het volgende geschreven:


I’m trying to use the REST DSL and do validation on the incoming object with the Bean Validation

I have configured my Spring XML like this:

 <setHeader headerName="Exchange.HTTP_RESPONSE_CODE">
   <simple>Validation error.\n\Message:\n${exception.message}</simple>

But when I use the Swagger UI to send a message to my endpoint, I get no body or HTTP response
code. For other exceptions this approach works.

Should this work with this exception?

I’m using version 2.17.3

Kind regards,

Remco Schoen

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message