Ralf Steppacher created CAMEL-9596:
--------------------------------------

             Summary: REST DSL  - Jetty component ignores custom HTTP Binding
                 Key: CAMEL-9596
                 URL: https://issues.apache.org/jira/browse/CAMEL-9596
             Project: Camel
          Issue Type: Bug
          Components: camel-jetty
    Affects Versions: 2.16.2
         Environment: Karaf, Blueprint
            Reporter: Ralf Steppacher


I am attempting to set a custom HTTP binding on the Jetty component used with 
the REST DSL:

{code:xml}
<bean id="jettyNoStackTraceHTTPBinding" 
class="ch.vivates.vel.rest.JettyNoStacktraceHttpBinding" />

<camelContext id="vel-jetty-rest-service" allowUseOriginalMessage="false" 
xmlns="http://camel.apache.org/schema/blueprint"; streamCache="false">
    <restConfiguration component="jetty" scheme="http" host="{{vel.rest.host}}" 
port="{{vel.rest.port}}" contextPath="{{vel.rest.contextpath}}" 
bindingMode="json">
        <endpointProperty key="httpBindingRef" 
value="jettyNoStackTraceHTTPBinding" />
    </restConfiguration>

    <!-- ... -->

</camelContext>
{code}

The http binding is not picked up though. At runtime the custom binding does 
not get triggered.
The logs show the generated endpoint URL without the {{httpBindingRef}} query 
parameter:

{noformat}
2016-02-12 16:22:15,454 | INFO  | pool-37-thread-1 | BlueprintCamelContext      
      | 64 - org.apache.camel.camel-core - 2.16.2 |   | Route: route1 started 
and consuming from: 
Endpoint[jetty:http://0.0.0.0:8181/vivates/vel/event/%7Bid%7D?httpMethodRestrict=PUT]
{noformat}

However, if I try to specify a binding bean that does not exist I receive an 
error during context ramp-up (as would be expected); the endpoint URI logged in 
the error message includes the {{httpBindingRef}} query parameter:

{noformat}
2016-02-12 16:26:17,194 | ERROR | Thread-35        | BlueprintCamelContext      
      | 61 - org.apache.camel.camel-blueprint - 2.16.2 |   | Error occurred 
during starting Camel: CamelContext(vel-jetty-rest-service) due Failed to 
resolve endpoint: 
jetty://http://0.0.0.0:8181/vivates/vel/event/%7Bid%7D?httpBindingRef=thisBindingBeanDoesNotExist&httpMethodRestrict=PUT
 due to: No bean could be found in the registry for: 
thisBindingBeanDoesNotExist of type: org.apache.camel.http.common.HttpBinding
org.apache.camel.ResolveEndpointFailedException: Failed to resolve endpoint: 
jetty://http://0.0.0.0:8181/vivates/vel/event/%7Bid%7D?httpBindingRef=thisBindingBeanDoesNotExist&httpMethodRestrict=PUT
 due to: No bean could be found in the registry for: 
thisBindingBeanDoesNotExist of type: org.apache.camel.http.common.HttpBinding
{noformat}



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

Reply via email to