This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel-spring-boot.git
The following commit(s) were added to refs/heads/main by this push: new dcc8da69f86 Regen dcc8da69f86 is described below commit dcc8da69f86ac0bd6aec7f1fb955fd8b331fd59b Author: Claus Ibsen <claus.ib...@gmail.com> AuthorDate: Thu Sep 28 16:16:15 2023 +0200 Regen --- .../camel/springboot/catalog/components/rest.json | 3 +- .../camel-rest-starter/src/main/docs/rest.json | 6 +++ .../springboot/RestComponentAutoConfiguration.java | 2 +- .../springboot/RestComponentConfiguration.java | 16 ++++++ .../rest/springboot/RestComponentConverter.java | 63 ++++++++++++++++++++++ ...rk.boot.autoconfigure.AutoConfiguration.imports | 1 + 6 files changed, 89 insertions(+), 2 deletions(-) diff --git a/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components/rest.json b/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components/rest.json index 10c34802a1c..a66cb43cb6d 100644 --- a/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components/rest.json +++ b/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components/rest.json @@ -29,7 +29,8 @@ "host": { "index": 3, "kind": "property", "displayName": "Host", "group": "producer", "label": "producer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Host and port of HTTP service to use (override host in swagger schema)" }, "lazyStartProducer": { "index": 4, "kind": "property", "displayName": "Lazy Start Producer", "group": "producer", "label": "producer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail [...] "producerComponentName": { "index": 5, "kind": "property", "displayName": "Producer Component Name", "group": "producer", "label": "producer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The Camel Rest component to use for the producer REST transport, such as http, undertow. If no component has been explicitly configured, then Camel will lookup if there is a Camel component that integra [...] - "autowiredEnabled": { "index": 6, "kind": "property", "displayName": "Autowired Enabled", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching t [...] + "autowiredEnabled": { "index": 6, "kind": "property", "displayName": "Autowired Enabled", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching t [...] + "headerFilterStrategy": { "index": 7, "kind": "property", "displayName": "Header Filter Strategy", "group": "filter", "label": "filter", "required": false, "type": "object", "javaType": "org.apache.camel.spi.HeaderFilterStrategy", "deprecated": false, "autowired": false, "secret": false, "description": "To use a custom org.apache.camel.spi.HeaderFilterStrategy to filter header to and from Camel message." } }, "headers": { "CamelRestHttpQuery": { "index": 0, "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The query parameters for the rest call to be used", "constantName": "org.apache.camel.component.rest.RestConstants#REST_HTTP_QUERY" }, diff --git a/components-starter/camel-rest-starter/src/main/docs/rest.json b/components-starter/camel-rest-starter/src/main/docs/rest.json index 587b3222002..d61d0947877 100644 --- a/components-starter/camel-rest-starter/src/main/docs/rest.json +++ b/components-starter/camel-rest-starter/src/main/docs/rest.json @@ -86,6 +86,12 @@ "description": "Whether to enable auto configuration of the rest component. This is enabled by default.", "sourceType": "org.apache.camel.component.rest.springboot.RestComponentConfiguration" }, + { + "name": "camel.component.rest.header-filter-strategy", + "type": "org.apache.camel.spi.HeaderFilterStrategy", + "description": "To use a custom org.apache.camel.spi.HeaderFilterStrategy to filter header to and from Camel message. The option is a org.apache.camel.spi.HeaderFilterStrategy type.", + "sourceType": "org.apache.camel.component.rest.springboot.RestComponentConfiguration" + }, { "name": "camel.component.rest.host", "type": "java.lang.String", diff --git a/components-starter/camel-rest-starter/src/main/java/org/apache/camel/component/rest/springboot/RestComponentAutoConfiguration.java b/components-starter/camel-rest-starter/src/main/java/org/apache/camel/component/rest/springboot/RestComponentAutoConfiguration.java index 8ba26b22221..7454a002cd0 100644 --- a/components-starter/camel-rest-starter/src/main/java/org/apache/camel/component/rest/springboot/RestComponentAutoConfiguration.java +++ b/components-starter/camel-rest-starter/src/main/java/org/apache/camel/component/rest/springboot/RestComponentAutoConfiguration.java @@ -42,7 +42,7 @@ import org.springframework.context.annotation.Lazy; @Conditional(ConditionalOnCamelContextAndAutoConfigurationBeans.class) @EnableConfigurationProperties({ComponentConfigurationProperties.class,RestComponentConfiguration.class}) @ConditionalOnHierarchicalProperties({"camel.component", "camel.component.rest"}) -@AutoConfigureAfter(CamelAutoConfiguration.class) +@AutoConfigureAfter({CamelAutoConfiguration.class, RestComponentConverter.class}) public class RestComponentAutoConfiguration { @Autowired diff --git a/components-starter/camel-rest-starter/src/main/java/org/apache/camel/component/rest/springboot/RestComponentConfiguration.java b/components-starter/camel-rest-starter/src/main/java/org/apache/camel/component/rest/springboot/RestComponentConfiguration.java index a22fc1f6005..3c8b7f65f07 100644 --- a/components-starter/camel-rest-starter/src/main/java/org/apache/camel/component/rest/springboot/RestComponentConfiguration.java +++ b/components-starter/camel-rest-starter/src/main/java/org/apache/camel/component/rest/springboot/RestComponentConfiguration.java @@ -16,6 +16,7 @@ */ package org.apache.camel.component.rest.springboot; +import org.apache.camel.spi.HeaderFilterStrategy; import org.apache.camel.spring.boot.ComponentConfigurationPropertiesCommon; import org.springframework.boot.context.properties.ConfigurationProperties; @@ -89,6 +90,12 @@ public class RestComponentConfiguration * etc. */ private Boolean autowiredEnabled = true; + /** + * To use a custom org.apache.camel.spi.HeaderFilterStrategy to filter + * header to and from Camel message. The option is a + * org.apache.camel.spi.HeaderFilterStrategy type. + */ + private HeaderFilterStrategy headerFilterStrategy; public Boolean getBridgeErrorHandler() { return bridgeErrorHandler; @@ -145,4 +152,13 @@ public class RestComponentConfiguration public void setAutowiredEnabled(Boolean autowiredEnabled) { this.autowiredEnabled = autowiredEnabled; } + + public HeaderFilterStrategy getHeaderFilterStrategy() { + return headerFilterStrategy; + } + + public void setHeaderFilterStrategy( + HeaderFilterStrategy headerFilterStrategy) { + this.headerFilterStrategy = headerFilterStrategy; + } } \ No newline at end of file diff --git a/components-starter/camel-rest-starter/src/main/java/org/apache/camel/component/rest/springboot/RestComponentConverter.java b/components-starter/camel-rest-starter/src/main/java/org/apache/camel/component/rest/springboot/RestComponentConverter.java new file mode 100644 index 00000000000..ce8e9c62ef4 --- /dev/null +++ b/components-starter/camel-rest-starter/src/main/java/org/apache/camel/component/rest/springboot/RestComponentConverter.java @@ -0,0 +1,63 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.component.rest.springboot; + +import java.util.LinkedHashSet; +import java.util.Set; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.context.properties.ConfigurationPropertiesBinding; +import org.springframework.context.ApplicationContext; +import org.springframework.context.annotation.Configuration; +import org.springframework.core.convert.TypeDescriptor; +import org.springframework.core.convert.converter.GenericConverter; +import org.springframework.stereotype.Component; + +/** + * Generated by camel-package-maven-plugin - do not edit this file! + */ +@Configuration(proxyBeanMethods = false) +@ConfigurationPropertiesBinding +@Component +public class RestComponentConverter implements GenericConverter { + + @Autowired + private ApplicationContext applicationContext; + + public Set<ConvertiblePair> getConvertibleTypes() { + Set<ConvertiblePair> answer = new LinkedHashSet<>(); + answer.add(new ConvertiblePair(String.class, org.apache.camel.spi.HeaderFilterStrategy.class)); + return answer; + } + + public Object convert( + Object source, + TypeDescriptor sourceType, + TypeDescriptor targetType) { + if (source == null) { + return null; + } + String ref = source.toString(); + if (!ref.startsWith("#")) { + return null; + } + ref = ref.startsWith("#bean:") ? ref.substring(6) : ref.substring(1); + switch (targetType.getName()) { + case "org.apache.camel.spi.HeaderFilterStrategy": return applicationContext.getBean(ref, org.apache.camel.spi.HeaderFilterStrategy.class); + } + return null; + } +} \ No newline at end of file diff --git a/components-starter/camel-rest-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/components-starter/camel-rest-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports index 81b04fc3c15..ff4013442f4 100644 --- a/components-starter/camel-rest-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports +++ b/components-starter/camel-rest-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -17,3 +17,4 @@ org.apache.camel.component.rest.springboot.RestApiComponentAutoConfiguration org.apache.camel.component.rest.springboot.RestComponentAutoConfiguration +org.apache.camel.component.rest.springboot.RestComponentConverter