Details
-
Improvement
-
Status: Resolved
-
Minor
-
Resolution: Won't Fix
-
2.15.2
-
None
-
None
-
Unknown
Description
The code in JettyHttpComponent seems to ignore any httpBindingRef endpoint property, at least if you use the REST DSL. It always creates a consumer with this binding if the RestConsumerFactory#createConsumer extension is used:
endpoint.setBinding(new JettyRestHttpBinding(endpoint));
This makes it impossible to configure custom error responses by overriding the doWriteExceptionResponse method of the binding, as documented.
My actual case is an (invalid) Java instance I'm transforming to JSON with Jackson. This happens in RestBindingMarshalOnCompletion#onAfterRoute and the only way to catch an exception at this stage seems to be in the HttpBinding.
Note that this means users of the REST DSL will always return 500 errors with full stacktraces on marshalling failures.
Attachments
Issue Links
- relates to
-
CAMEL-9053 rest-dsl - Add some dsl or spi to deal with exceptions during marshalling response
- Resolved