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

Replace hardcoded JettyRestHttpBinding instantiation in JettyHttpComponent

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Won't Fix
    • 2.15.2
    • None
    • camel-jetty
    • 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

          Activity

            People

              Unassigned Unassigned
              apache@christianbauer.name Christian Bauer
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: