camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Christian Bauer (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (CAMEL-9034) Replace hardcoded JettyRestHttpBinding instantiation in JettyHttpComponent
Date Wed, 29 Jul 2015 16:38:05 GMT

     [ https://issues.apache.org/jira/browse/CAMEL-9034?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Christian Bauer updated CAMEL-9034:
-----------------------------------
    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:

{code}
endpoint.setBinding(new JettyRestHttpBinding(endpoint));
{code}

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.

  was:
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:

{code}
endpoint.setBinding(new JettyRestHttpBinding(endpoint));
{code}

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.


> Replace hardcoded JettyRestHttpBinding instantiation in JettyHttpComponent
> --------------------------------------------------------------------------
>
>                 Key: CAMEL-9034
>                 URL: https://issues.apache.org/jira/browse/CAMEL-9034
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-jetty
>    Affects Versions: 2.15.2
>            Reporter: Christian Bauer
>
> 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:
> {code}
> endpoint.setBinding(new JettyRestHttpBinding(endpoint));
> {code}
> 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.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message