Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-9596

REST DSL - Jetty component ignores custom HTTP Binding

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.16.2
    • Fix Version/s: 2.16.3, 2.17.0
    • Component/s: camel-jetty
    • Labels:
      None
    • Environment:

      Karaf, Blueprint

    • Estimated Complexity:
      Unknown

      Description

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

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

      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:

      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]
      

      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:

      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
      

        Attachments

          Activity

            People

            • Assignee:
              davsclaus Claus Ibsen
              Reporter:
              ralfsteppacher Ralf Steppacher
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: