[
https://issues.apache.org/jira/browse/CAMEL-12864?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Claus Ibsen updated CAMEL-12864:
--------------------------------
Description:
When defining a rest-swagger component
{code}
@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; }
{code}
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):(
{code}
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");
{code}
The attribute host should not be overwritten by the host-header, if it is set
explicitly on the component.
was:
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.
> rest: Host header should not overwrite host attribute on rest-swagger
> component
> -------------------------------------------------------------------------------
>
> Key: CAMEL-12864
> URL: https://issues.apache.org/jira/browse/CAMEL-12864
> Project: Camel
> Issue Type: Improvement
> Components: rest
> Affects Versions: 2.22.1
> Reporter: Jochen Cordes
> Priority: Minor
>
> When defining a rest-swagger component
> {code}
> @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; }
> {code}
> 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):(
> {code}
> 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");
> {code}
> The attribute host should not be overwritten by the host-header, if it is set
> explicitly on the component.
>
--
This message was sent by Atlassian JIRA
(v7.6.14#76016)