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

rest: Host header should not overwrite host attribute on rest-swagger component

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 2.22.1
    • 3.0.0.RC1, 3.0.0
    • rest
    • None
    • Unknown

    Description

      When defining a rest-swagger component

      @Bean
       public Component mobile(CamelContext camelContext) throws URISyntaxException
      
      { RestSwaggerComponent mobile = new RestSwaggerComponent(camelContext); mobile.setHost(mobileHost); mobile.setBasePath(mobileBasePath); mobile.setSpecificationUri( new URI(mobileSpecificationPath)); mobile.setComponentName("http4"); return mobile; }
      

      in the following route (rest-endpoint missing, this is calling direct:getMobileAccountById) the host attribute is overwritten by the previous host header (therefore removeHeader needs to be called prior to invocation of the rest-swagger endpoint)

      from("direct:getMobileAccountById").routeId("getMobileAccountById")
       .setHeader("customerId", simple("headers.mobileAndFixedlineCustomerId.split(',')[1]"))
       .removeHeader("Host")
       .to("mobile:getAccountById")
       .unmarshal(gsonDataFormatMobile)
       .log("Just got called for Mobile");
      

      The attribute host should not be overwritten by the host-header, if it is set explicitly on the component.

       

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            davsclaus Claus Ibsen
            jcordes Jochen Cordes
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment