diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9e8bb12..3f7b5c1 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,33 @@
===========================
+## [2.1.0](https://github.com/buession/buession-springcloud/releases/tag/v2.1.0) (2022-08-07)
+
+### 🔨依赖升级
+
+- [依赖库版本升级和安全漏洞修复](https://github.com/buession/buession-parent/releases/tag/v2.1.0)
+- [openfeign] 版本升级至 11.9.1
+
+
+### ⭐ 新特性
+
+- **buession-springcloud-bus:** 新增 buession-springcloud-bus module
+- **buession-springcloud-feign:** 可指定允许转发和忽略的请求头
+
+
+### 🔔 变化
+
+- **buession-springcloud-feign:** Servlet 模式请求头拦截器,ServletClientHeadersRequestInterceptor 将会转发重复请求头的所有值
+
+
+### 🐞 Bug 修复
+
+- **buession-springcloud-feign:** 修复 ReactiveFeignInterceptorConfiguration 自动配置设置成 Type.SERVLET 的 BUG
+
+
+---
+
+
## [2.0.2](https://github.com/buession/buession-springcloud/releases/tag/v2.0.2) (2022-07-28)
### 🔨依赖升级
@@ -9,6 +36,9 @@
- [依赖库版本升级和安全漏洞修复](https://github.com/buession/buession-parent/releases/tag/v2.0.2)
+---
+
+
## [2.0.1](https://github.com/buession/buession-springcloud/releases/tag/v2.0.1) (2022-07-18)
### 🔨依赖升级
@@ -18,6 +48,9 @@
- spring-cloud-starter-alibaba-nacos-discovery 版本升级至 2.2.8.RELEASE
+---
+
+
## [2.0.0](https://github.com/buession/buession-springcloud/releases/tag/v2.0.0) (2022-07-08)
### 🔨依赖升级
diff --git a/buession-springcloud-bus/pom.xml b/buession-springcloud-bus/pom.xml
new file mode 100644
index 0000000..30cfebe
--- /dev/null
+++ b/buession-springcloud-bus/pom.xml
@@ -0,0 +1,138 @@
+
+
+ Buession Springcloud Bus
+ 4.0.0
+
+ com.buession.springcloud
+ buession-springcloud-parent
+ ../buession-springcloud-parent
+ 2.1.0
+
+ buession-springcloud-bus
+ https://github.com/buession/buession-springcloud
+ Buession Framework Spring Cloud Bus
+ jar
+
+
+ buession.com Inc.
+ http://www.buession.com/
+
+
+
+
+ yong.teng
+ yong.teng
+ webmaster@buession.com
+
+ Project Manager
+ Developer
+
+
+
+
+
+
+ The Apache License, Version 2.0
+ http://www.apache.org/licenses/LICENSE-2.0.txt
+ repo
+ A business-friendly OSS license
+
+
+
+
+ scm:git:https://github.com/buession/buession-springcloud.git
+ scm:git:https://github.com/buession/buession-springcloud.git
+ https://github.com/buession/buession-springcloud
+
+
+
+ github
+ https://github.com/buession/buession-springcloud/issues
+
+
+
+
+ com.buession.springcloud
+ buession-springcloud-common
+ ${project.version}
+
+
+ org.apache.httpcomponents
+ *
+
+
+
+
+
+ org.springframework
+ spring-messaging
+
+
+
+ org.springframework.cloud
+ spring-cloud-bus
+ 2.2.4.RELEASE
+
+
+ org.springframework.cloud
+ spring-cloud-stream
+
+
+
+ org.slf4j
+ slf4j-api
+
+
+
+ junit
+ junit
+
+
+
+
+ buession-springcloud-bus
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+
+
+ org.apache.maven.plugins
+ maven-jar-plugin
+
+
+ org.apache.maven.plugins
+ maven-source-plugin
+
+
+ org.apache.maven.plugins
+ maven-javadoc-plugin
+
+
+ org.apache.maven.plugins
+ maven-resources-plugin
+
+
+ org.apache.maven.plugins
+ maven-checkstyle-plugin
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+
+
+ org.apache.maven.plugins
+ maven-release-plugin
+
+
+ org.apache.maven.plugins
+ maven-gpg-plugin
+
+
+ org.sonatype.plugins
+ nexus-staging-maven-plugin
+
+
+
+
\ No newline at end of file
diff --git a/buession-springcloud-common/pom.xml b/buession-springcloud-common/pom.xml
index 0cf80d8..c256668 100644
--- a/buession-springcloud-common/pom.xml
+++ b/buession-springcloud-common/pom.xml
@@ -7,7 +7,7 @@
com.buession.springcloud
buession-springcloud-parent
../buession-springcloud-parent
- 2.0.2
+ 2.1.0
buession-springcloud-common
https://github.com/buession/buession-springcloud
@@ -46,6 +46,11 @@
https://github.com/buession/buession-springcloud
+
+ github
+ https://github.com/buession/buession-springcloud/issues
+
+
com.buession.springboot
@@ -61,10 +66,12 @@
spring-cloud-context
+
org.springframework.retry
@@ -72,8 +79,24 @@
- commons-codec
- commons-codec
+ org.apache.httpcomponents
+ httpcore
+
+
+ commons-logging
+ commons-logging
+
+
+
+
+ org.apache.httpcomponents
+ httpclient
+
+
+ commons-logging
+ commons-logging
+
+
diff --git a/buession-springcloud-config-client/pom.xml b/buession-springcloud-config-client/pom.xml
index 3ee1ea7..8a5291d 100644
--- a/buession-springcloud-config-client/pom.xml
+++ b/buession-springcloud-config-client/pom.xml
@@ -7,7 +7,7 @@
com.buession.springcloud
buession-springcloud-parent
../buession-springcloud-parent
- 2.0.2
+ 2.1.0
buession-springcloud-config-client
https://github.com/buession/buession-springcloud
@@ -46,12 +46,22 @@
https://github.com/buession/buession-springcloud
+
+ github
+ https://github.com/buession/buession-springcloud/issues
+
+
com.buession.springcloud
buession-springcloud-common
${project.version}
+
+ com.buession.springcloud
+ buession-springcloud-bus
+ ${project.version}
+
org.springframework
@@ -65,24 +75,8 @@
- org.apache.httpcomponents
- httpcore
-
-
- commons-logging
- commons-logging
-
-
-
-
- org.apache.httpcomponents
- httpclient
-
-
- commons-logging
- commons-logging
-
-
+ org.springframework.security
+ spring-security-crypto
diff --git a/buession-springcloud-config-server/pom.xml b/buession-springcloud-config-server/pom.xml
index 5076d63..c9bc120 100644
--- a/buession-springcloud-config-server/pom.xml
+++ b/buession-springcloud-config-server/pom.xml
@@ -7,7 +7,7 @@
com.buession.springcloud
buession-springcloud-parent
../buession-springcloud-parent
- 2.0.2
+ 2.1.0
buession-springcloud-config-server
https://github.com/buession/buession-springcloud
@@ -46,6 +46,11 @@
https://github.com/buession/buession-springcloud
+
+ github
+ https://github.com/buession/buession-springcloud/issues
+
+
com.buession.springcloud
@@ -94,27 +99,6 @@
spring-security-crypto
-
- org.apache.httpcomponents
- httpcore
-
-
- commons-logging
- commons-logging
-
-
-
-
- org.apache.httpcomponents
- httpclient
-
-
- commons-logging
- commons-logging
-
-
-
-
com.fasterxml.jackson.dataformat
jackson-dataformat-yaml
diff --git a/buession-springcloud-consul/pom.xml b/buession-springcloud-consul/pom.xml
index 682dae4..5578058 100644
--- a/buession-springcloud-consul/pom.xml
+++ b/buession-springcloud-consul/pom.xml
@@ -7,7 +7,7 @@
com.buession.springcloud
buession-springcloud-parent
../buession-springcloud-parent
- 2.0.2
+ 2.1.0
buession-springcloud-consul
https://github.com/buession/buession-springcloud
@@ -46,6 +46,11 @@
https://github.com/buession/buession-springcloud
+
+ github
+ https://github.com/buession/buession-springcloud/issues
+
+
com.buession.springcloud
@@ -80,27 +85,6 @@
jakarta.validation-api
-
- org.apache.httpcomponents
- httpcore
-
-
- commons-logging
- commons-logging
-
-
-
-
- org.apache.httpcomponents
- httpclient
-
-
- commons-logging
- commons-logging
-
-
-
-
org.hibernate.validator
hibernate-validator
diff --git a/buession-springcloud-feign/pom.xml b/buession-springcloud-feign/pom.xml
index 1777231..81d2cb7 100644
--- a/buession-springcloud-feign/pom.xml
+++ b/buession-springcloud-feign/pom.xml
@@ -7,7 +7,7 @@
com.buession.springcloud
buession-springcloud-parent
../buession-springcloud-parent
- 2.0.2
+ 2.1.0
buession-springcloud-feign
https://github.com/buession/buession-springcloud
@@ -46,8 +46,13 @@
https://github.com/buession/buession-springcloud
+
+ github
+ https://github.com/buession/buession-springcloud/issues
+
+
- 11.7
+ 11.9.1
@@ -122,27 +127,6 @@
true
-
- org.apache.httpcomponents
- httpcore
-
-
- commons-logging
- commons-logging
-
-
-
-
- org.apache.httpcomponents
- httpclient
-
-
- commons-logging
- commons-logging
-
-
-
-
com.google.guava
guava
diff --git a/buession-springcloud-feign/src/main/java/com/buession/springcloud/feign/autoconfigure/FeignInterceptorConfiguration.java b/buession-springcloud-feign/src/main/java/com/buession/springcloud/feign/autoconfigure/FeignInterceptorConfiguration.java
index a671295..0344365 100644
--- a/buession-springcloud-feign/src/main/java/com/buession/springcloud/feign/autoconfigure/FeignInterceptorConfiguration.java
+++ b/buession-springcloud-feign/src/main/java/com/buession/springcloud/feign/autoconfigure/FeignInterceptorConfiguration.java
@@ -30,6 +30,7 @@
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
+import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@@ -38,29 +39,50 @@
*/
@Configuration(proxyBeanMethods = false)
@ConditionalOnProperty(prefix = "spring.cloud.feign", name = "apply-client-request-headers.enabled", havingValue = "true", matchIfMissing = true)
+@EnableConfigurationProperties(FeignProperties.class)
@ConditionalOnWebApplication
public class FeignInterceptorConfiguration {
+ protected FeignProperties feignProperties;
+
+ public FeignInterceptorConfiguration(FeignProperties feignProperties){
+ this.feignProperties = feignProperties;
+ }
+
@Configuration(proxyBeanMethods = false)
+ @EnableConfigurationProperties(FeignProperties.class)
@ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.SERVLET)
static class ServletFeignInterceptorConfiguration extends FeignInterceptorConfiguration {
+ public ServletFeignInterceptorConfiguration(FeignProperties feignProperties){
+ super(feignProperties);
+ }
+
@Bean
@ConditionalOnMissingBean
public RequestInterceptor servletClientHeadersRequestInterceptor(){
- return new ServletClientHeadersRequestInterceptor();
+ return new ServletClientHeadersRequestInterceptor(
+ feignProperties.getApplyClientRequestHeaders().getAllowedHeaderNames(),
+ feignProperties.getApplyClientRequestHeaders().getIgnoreHeaderNames());
}
}
@Configuration(proxyBeanMethods = false)
- @ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.SERVLET)
+ @EnableConfigurationProperties(FeignProperties.class)
+ @ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.REACTIVE)
static class ReactiveFeignInterceptorConfiguration extends FeignInterceptorConfiguration {
+ public ReactiveFeignInterceptorConfiguration(FeignProperties feignProperties){
+ super(feignProperties);
+ }
+
@Bean
@ConditionalOnMissingBean
public RequestInterceptor reactiveClientHeadersRequestInterceptor(){
- return new ReactiveClientHeadersRequestInterceptor();
+ return new ReactiveClientHeadersRequestInterceptor(
+ feignProperties.getApplyClientRequestHeaders().getAllowedHeaderNames(),
+ feignProperties.getApplyClientRequestHeaders().getIgnoreHeaderNames());
}
}
diff --git a/buession-springcloud-feign/src/main/java/com/buession/springcloud/feign/autoconfigure/FeignProperties.java b/buession-springcloud-feign/src/main/java/com/buession/springcloud/feign/autoconfigure/FeignProperties.java
new file mode 100644
index 0000000..1baa29a
--- /dev/null
+++ b/buession-springcloud-feign/src/main/java/com/buession/springcloud/feign/autoconfigure/FeignProperties.java
@@ -0,0 +1,104 @@
+/*
+ * 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.
+ *
+ * =========================================================================================================
+ *
+ * This software consists of voluntary contributions made by many individuals on behalf of the
+ * Apache Software Foundation. For more information on the Apache Software Foundation, please see
+ * .
+ *
+ * +-------------------------------------------------------------------------------------------------------+
+ * | License: http://www.apache.org/licenses/LICENSE-2.0.txt |
+ * | Author: Yong.Teng |
+ * | Copyright @ 2013-2022 Buession.com Inc. |
+ * +-------------------------------------------------------------------------------------------------------+
+ */
+package com.buession.springcloud.feign.autoconfigure;
+
+import com.buession.core.builder.SetBuilder;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.boot.context.properties.NestedConfigurationProperty;
+
+import java.util.Set;
+
+/**
+ * @author Yong.Teng
+ * @since 2.1.0
+ */
+@ConfigurationProperties(prefix = "spring.cloud.feign")
+public class FeignProperties {
+
+ @NestedConfigurationProperty
+ private ApplyClientRequestHeaders applyClientRequestHeaders = new ApplyClientRequestHeaders();
+
+ public ApplyClientRequestHeaders getApplyClientRequestHeaders(){
+ return applyClientRequestHeaders;
+ }
+
+ public void setApplyClientRequestHeaders(
+ ApplyClientRequestHeaders applyClientRequestHeaders){
+ this.applyClientRequestHeaders = applyClientRequestHeaders;
+ }
+
+ public final static class ApplyClientRequestHeaders {
+
+ /**
+ * 允许的请求头
+ */
+ private Set allowedHeaderNames;
+
+ /**
+ * 忽略的请求头
+ */
+ private Set ignoreHeaderNames = SetBuilder.of("Accept-Encoding");
+
+ /**
+ * 返回允许的请求头
+ *
+ * @return 允许的请求头
+ */
+ public Set getAllowedHeaderNames(){
+ return allowedHeaderNames;
+ }
+
+ /**
+ * 设置允许的请求头
+ *
+ * @param allowedHeaderNames
+ * 允许的请求头
+ */
+ public void setAllowedHeaderNames(Set allowedHeaderNames){
+ this.allowedHeaderNames = allowedHeaderNames;
+ }
+
+ /**
+ * 返回忽略的请求头
+ *
+ * @return 忽略的请求头
+ */
+ public Set getIgnoreHeaderNames(){
+ return ignoreHeaderNames;
+ }
+
+ /**
+ * 设置忽略的请求头
+ *
+ * @param ignoreHeaderNames
+ * 忽略的请求头
+ */
+ public void setIgnoreHeaderNames(Set ignoreHeaderNames){
+ this.ignoreHeaderNames = ignoreHeaderNames;
+ }
+
+ }
+
+}
diff --git a/buession-springcloud-feign/src/main/java/com/buession/springcloud/feign/interceptor/AbstractClientHeadersRequestInterceptor.java b/buession-springcloud-feign/src/main/java/com/buession/springcloud/feign/interceptor/AbstractClientHeadersRequestInterceptor.java
index ee69410..5bb811c 100644
--- a/buession-springcloud-feign/src/main/java/com/buession/springcloud/feign/interceptor/AbstractClientHeadersRequestInterceptor.java
+++ b/buession-springcloud-feign/src/main/java/com/buession/springcloud/feign/interceptor/AbstractClientHeadersRequestInterceptor.java
@@ -24,14 +24,18 @@
*/
package com.buession.springcloud.feign.interceptor;
-import com.buession.core.builder.ListBuilder;
+import com.buession.core.builder.SetBuilder;
import com.buession.core.utils.VersionUtils;
+import com.buession.core.validator.Validate;
import com.buession.springcloud.common.Version;
import feign.Feign;
import feign.RequestInterceptor;
import feign.RequestTemplate;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.util.List;
+import java.util.Set;
/**
* 请求头拦截器抽象类
@@ -45,14 +49,129 @@ public abstract class AbstractClientHeadersRequestInterceptor implements Request
protected final static String BUESSION_CLOUD_NAME = "X-Buession-Cloud-Version";
- protected final static List IGNORE_REQUEST_HEADERS = ListBuilder.of("Accept-Encoding");
-
protected final static String REQUEST_CONTEXT_CLIENT =
Feign.class.getSimpleName() + "/" + VersionUtils.determineClassVersion(Feign.class);
+ /**
+ * 允许转发的请求头
+ *
+ * @since 2.1.0
+ */
+ private Set allowedHeaderNames;
+
+ /**
+ * 忽略转发的请求头
+ *
+ * @since 2.1.0
+ */
+ private Set ignoreHeaderNames = SetBuilder.of("Accept-Encoding");
+
+ protected final Logger logger = LoggerFactory.getLogger(getClass());
+
+ /**
+ * 构造函数
+ */
+ public AbstractClientHeadersRequestInterceptor(){
+ }
+
+ /**
+ * 构造函数
+ *
+ * @param allowedHeaderNames
+ * 允许转发的请求头
+ * @param ignoreHeaderNames
+ * 忽略转发的请求头
+ *
+ * @since 2.1.0
+ */
+ public AbstractClientHeadersRequestInterceptor(Set allowedHeaderNames,
+ Set ignoreHeaderNames){
+ this.allowedHeaderNames = allowedHeaderNames;
+ this.ignoreHeaderNames = ignoreHeaderNames;
+ }
+
+ /**
+ * 返回允许转发的请求头
+ *
+ * @return 允许转发的请求头
+ */
+ public Set getAllowedHeaderNames(){
+ return allowedHeaderNames;
+ }
+
+ /**
+ * 设置允许转发的请求头
+ *
+ * @param allowedHeaderNames
+ * 允许转发的请求头
+ */
+ public void setAllowedHeaderNames(Set allowedHeaderNames){
+ this.allowedHeaderNames = allowedHeaderNames;
+ }
+
+ /**
+ * 返回忽略转发的请求头
+ *
+ * @return 忽略转发的请求头
+ */
+ public Set getIgnoreHeaderNames(){
+ return ignoreHeaderNames;
+ }
+
+ /**
+ * 设置忽略转发的请求头
+ *
+ * @param ignoreHeaderNames
+ * 忽略转发的请求头
+ */
+ public void setIgnoreHeaderNames(Set ignoreHeaderNames){
+ this.ignoreHeaderNames = ignoreHeaderNames;
+ }
+
protected static void setRequestHeaders(final RequestTemplate requestTemplate){
requestTemplate.header(REQUEST_CONTEXT_CLIENT_NAME, REQUEST_CONTEXT_CLIENT);
requestTemplate.header(BUESSION_CLOUD_NAME, Version.VERSION);
}
+ protected boolean isIgnoreHeaderName(final String name){
+ Set ignoreHeaderNames = getIgnoreHeaderNames();
+
+ if(Validate.isNotEmpty(ignoreHeaderNames)){
+ for(String headerName : ignoreHeaderNames){
+ if(headerName.contains(name)){
+ if(logger.isDebugEnabled()){
+ logger.debug("Ignore feign request header, name: {}", name);
+ }
+ return true;
+ }
+ }
+ }
+
+ return false;
+ }
+
+ protected void applyHeader(final RequestTemplate requestTemplate, final String name, final List values){
+ if(isIgnoreHeaderName(name)){
+ return;
+ }
+
+ Set allowedHeaderNames = getAllowedHeaderNames();
+
+ if(Validate.isNotEmpty(allowedHeaderNames)){
+ for(String headerName : allowedHeaderNames){
+ if(headerName.contains(name)){
+ requestTemplate.header(name, values);
+ if(logger.isDebugEnabled()){
+ logger.debug("Add feign request header, name: {}, values: {}", name, values);
+ }
+ }
+ }
+ }else{
+ requestTemplate.header(name, values);
+ if(logger.isDebugEnabled()){
+ logger.debug("Add feign request header, name: {}, values: {}", name, values);
+ }
+ }
+ }
+
}
diff --git a/buession-springcloud-feign/src/main/java/com/buession/springcloud/feign/interceptor/reactive/ReactiveClientHeadersRequestInterceptor.java b/buession-springcloud-feign/src/main/java/com/buession/springcloud/feign/interceptor/reactive/ReactiveClientHeadersRequestInterceptor.java
index b3d7a8b..913cf85 100644
--- a/buession-springcloud-feign/src/main/java/com/buession/springcloud/feign/interceptor/reactive/ReactiveClientHeadersRequestInterceptor.java
+++ b/buession-springcloud-feign/src/main/java/com/buession/springcloud/feign/interceptor/reactive/ReactiveClientHeadersRequestInterceptor.java
@@ -25,42 +25,50 @@
package com.buession.springcloud.feign.interceptor.reactive;
import com.buession.springcloud.feign.interceptor.AbstractClientHeadersRequestInterceptor;
-import com.buession.web.reactive.context.request.RequestContextHolder;
+import com.buession.web.reactive.context.request.ReactiveRequestAttributes;
import feign.RequestTemplate;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.springframework.http.server.reactive.ServerHttpRequest;
-import reactor.core.publisher.Mono;
+import org.springframework.web.context.request.RequestContextHolder;
+
+import java.util.Set;
/**
- * Reactive 请求头拦截器抽象类
+ * Reactive 模式请求头拦截器
*
* @author Yong.Teng
* @since 1.2.1
*/
public class ReactiveClientHeadersRequestInterceptor extends AbstractClientHeadersRequestInterceptor {
- private final static Logger logger = LoggerFactory.getLogger(ReactiveClientHeadersRequestInterceptor.class);
+ /**
+ * 构造函数
+ */
+ public ReactiveClientHeadersRequestInterceptor(){
+ super();
+ }
+
+ /**
+ * 构造函数
+ *
+ * @param allowedHeaderNames
+ * 允许转发的请求头
+ * @param ignoreHeaderNames
+ * 忽略转发的请求头
+ *
+ * @since 2.1.0
+ */
+ public ReactiveClientHeadersRequestInterceptor(Set allowedHeaderNames,
+ Set ignoreHeaderNames){
+ super(allowedHeaderNames, ignoreHeaderNames);
+ }
@Override
public void apply(RequestTemplate requestTemplate){
try{
- Mono mono = RequestContextHolder.getRequest();
+ ReactiveRequestAttributes requestAttributes = (ReactiveRequestAttributes) RequestContextHolder.currentRequestAttributes();
+ ServerHttpRequest request = requestAttributes.getRequest();
- mono.subscribe(request->{
- request.getHeaders().forEach((name, value)->{
- if(IGNORE_REQUEST_HEADERS.contains(name)){
- if(logger.isDebugEnabled()){
- logger.debug("Ignore feign request header, name: {}", name);
- }
- }else{
- requestTemplate.header(name, value);
- if(logger.isDebugEnabled()){
- logger.debug("Add feign request header, name: {}, values: {}", name, value);
- }
- }
- });
- });
+ request.getHeaders().forEach((name, value)->applyHeader(requestTemplate, name, value));
}catch(IllegalStateException e){
logger.error(e.getMessage());
}finally{
diff --git a/buession-springcloud-feign/src/main/java/com/buession/springcloud/feign/interceptor/servlet/ServletClientHeadersRequestInterceptor.java b/buession-springcloud-feign/src/main/java/com/buession/springcloud/feign/interceptor/servlet/ServletClientHeadersRequestInterceptor.java
index 404a1d4..c65071e 100644
--- a/buession-springcloud-feign/src/main/java/com/buession/springcloud/feign/interceptor/servlet/ServletClientHeadersRequestInterceptor.java
+++ b/buession-springcloud-feign/src/main/java/com/buession/springcloud/feign/interceptor/servlet/ServletClientHeadersRequestInterceptor.java
@@ -28,46 +28,65 @@
import com.buession.springcloud.feign.interceptor.AbstractClientHeadersRequestInterceptor;
import feign.RequestTemplate;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
+import java.util.ArrayList;
import java.util.Enumeration;
+import java.util.List;
+import java.util.Set;
/**
- * Servlet 请求头拦截器抽象类
+ * Servlet 模式请求头拦截器
*
* @author Yong.Teng
*/
public class ServletClientHeadersRequestInterceptor extends AbstractClientHeadersRequestInterceptor {
- private final static Logger logger = LoggerFactory.getLogger(ServletClientHeadersRequestInterceptor.class);
+ /**
+ * 构造函数
+ */
+ public ServletClientHeadersRequestInterceptor(){
+ super();
+ }
+
+ /**
+ * 构造函数
+ *
+ * @param allowedHeaderNames
+ * 允许转发的请求头
+ * @param ignoreHeaderNames
+ * 忽略转发的请求头
+ *
+ * @since 2.1.0
+ */
+ public ServletClientHeadersRequestInterceptor(Set allowedHeaderNames,
+ Set ignoreHeaderNames){
+ super(allowedHeaderNames, ignoreHeaderNames);
+ }
@Override
public void apply(final RequestTemplate requestTemplate){
try{
- ServletRequestAttributes attributes =
+ ServletRequestAttributes requestAttributes =
(ServletRequestAttributes) RequestContextHolder.currentRequestAttributes();
- HttpServletRequest request = attributes.getRequest();
+ HttpServletRequest request = requestAttributes.getRequest();
Enumeration headerNames = request.getHeaderNames();
while(headerNames != null && headerNames.hasMoreElements()){
String name = headerNames.nextElement();
- if(IGNORE_REQUEST_HEADERS.contains(name)){
- if(logger.isDebugEnabled()){
- logger.debug("Ignore feign request header, name: {}", name);
- }
- }else{
- String value = request.getHeader(name);
+ if(isIgnoreHeaderName(name) == false){
+ Enumeration value = request.getHeaders(name);
+ List values = new ArrayList<>();
- requestTemplate.header(name, value);
- if(logger.isDebugEnabled()){
- logger.debug("Add feign request header, name: {}, values: {}", name, value);
+ while(value != null && value.hasMoreElements()){
+ values.add(value.nextElement());
}
+
+ applyHeader(requestTemplate, name, values);
}
}
}catch(IllegalStateException e){
diff --git a/buession-springcloud-gateway/pom.xml b/buession-springcloud-gateway/pom.xml
index 2be1a3d..91ce914 100644
--- a/buession-springcloud-gateway/pom.xml
+++ b/buession-springcloud-gateway/pom.xml
@@ -7,7 +7,7 @@
com.buession.springcloud
buession-springcloud-parent
../buession-springcloud-parent
- 2.0.2
+ 2.1.0
buession-springcloud-gateway
https://github.com/buession/buession-springcloud
@@ -46,6 +46,11 @@
https://github.com/buession/buession-springcloud
+
+ github
+ https://github.com/buession/buession-springcloud/issues
+
+
com.buession.springcloud
@@ -75,27 +80,6 @@
2.2.10.RELEASE
-
- org.apache.httpcomponents
- httpcore
-
-
- commons-logging
- commons-logging
-
-
-
-
- org.apache.httpcomponents
- httpclient
-
-
- commons-logging
- commons-logging
-
-
-
-
org.hibernate.validator
hibernate-validator
diff --git a/buession-springcloud-hystrix/pom.xml b/buession-springcloud-hystrix/pom.xml
index b216fdf..47b21ff 100644
--- a/buession-springcloud-hystrix/pom.xml
+++ b/buession-springcloud-hystrix/pom.xml
@@ -7,7 +7,7 @@
com.buession.springcloud
buession-springcloud-parent
../buession-springcloud-parent
- 2.0.2
+ 2.1.0
buession-springcloud-hystrix
https://github.com/buession/buession-springcloud
@@ -46,17 +46,28 @@
https://github.com/buession/buession-springcloud
+
+ github
+ https://github.com/buession/buession-springcloud/issues
+
+
com.buession.springcloud
buession-springcloud-common
${project.version}
+
+
+ org.apache.httpcomponents
+ *
+
+
org.springframework.cloud
spring-cloud-starter-netflix-hystrix
- 2.2.10.RELEASE
+ ${springcloud.netflix.version}
diff --git a/buession-springcloud-kubernetes/pom.xml b/buession-springcloud-kubernetes/pom.xml
index 0b89590..7ccaecb 100644
--- a/buession-springcloud-kubernetes/pom.xml
+++ b/buession-springcloud-kubernetes/pom.xml
@@ -7,7 +7,7 @@
com.buession.springcloud
buession-springcloud-parent
../buession-springcloud-parent
- 2.0.2
+ 2.1.0
buession-springcloud-kubernetes
https://github.com/buession/buession-springcloud
@@ -46,6 +46,11 @@
https://github.com/buession/buession-springcloud
+
+ github
+ https://github.com/buession/buession-springcloud/issues
+
+
1.1.10.RELEASE
@@ -101,27 +106,6 @@
jakarta.el
-
- org.apache.httpcomponents
- httpcore
-
-
- commons-logging
- commons-logging
-
-
-
-
- org.apache.httpcomponents
- httpclient
-
-
- commons-logging
- commons-logging
-
-
-
-
com.squareup.okhttp3
okhttp
diff --git a/buession-springcloud-metrics/pom.xml b/buession-springcloud-metrics/pom.xml
index 3fe0aaf..d5ffbbb 100644
--- a/buession-springcloud-metrics/pom.xml
+++ b/buession-springcloud-metrics/pom.xml
@@ -7,7 +7,7 @@
com.buession.springcloud
buession-springcloud-parent
../buession-springcloud-parent
- 2.0.2
+ 2.1.0
buession-springcloud-metrics
https://github.com/buession/buession-springcloud
@@ -46,11 +46,22 @@
https://github.com/buession/buession-springcloud
+
+ github
+ https://github.com/buession/buession-springcloud/issues
+
+
com.buession.springcloud
buession-springcloud-common
${project.version}
+
+
+ org.apache.httpcomponents
+ *
+
+
diff --git a/buession-springcloud-nacos-config-client/pom.xml b/buession-springcloud-nacos-config-client/pom.xml
index cdd163b..9fc5fe2 100644
--- a/buession-springcloud-nacos-config-client/pom.xml
+++ b/buession-springcloud-nacos-config-client/pom.xml
@@ -7,7 +7,7 @@
com.buession.springcloud
buession-springcloud-parent
../buession-springcloud-parent
- 2.0.2
+ 2.1.0
buession-springcloud-nacos-config-client
https://github.com/buession/buession-springcloud
@@ -46,6 +46,11 @@
https://github.com/buession/buession-springcloud
+
+ github
+ https://github.com/buession/buession-springcloud/issues
+
+
com.buession.springcloud
@@ -65,27 +70,6 @@
-
- org.apache.httpcomponents
- httpcore
-
-
- commons-logging
- commons-logging
-
-
-
-
- org.apache.httpcomponents
- httpclient
-
-
- commons-logging
- commons-logging
-
-
-
-
com.google.code.findbugs
jsr305
diff --git a/buession-springcloud-nacos-discovery/pom.xml b/buession-springcloud-nacos-discovery/pom.xml
index 62dd4e0..9576480 100644
--- a/buession-springcloud-nacos-discovery/pom.xml
+++ b/buession-springcloud-nacos-discovery/pom.xml
@@ -7,7 +7,7 @@
com.buession.springcloud
buession-springcloud-parent
../buession-springcloud-parent
- 2.0.2
+ 2.1.0
buession-springcloud-nacos-discovery
https://github.com/buession/buession-springcloud
@@ -46,6 +46,11 @@
https://github.com/buession/buession-springcloud
+
+ github
+ https://github.com/buession/buession-springcloud/issues
+
+
com.buession.springcloud
@@ -75,27 +80,6 @@
-
- org.apache.httpcomponents
- httpcore
-
-
- commons-logging
- commons-logging
-
-
-
-
- org.apache.httpcomponents
- httpclient
-
-
- commons-logging
- commons-logging
-
-
-
-
com.google.code.findbugs
jsr305
diff --git a/buession-springcloud-parent/pom.xml b/buession-springcloud-parent/pom.xml
index 0091902..a752935 100644
--- a/buession-springcloud-parent/pom.xml
+++ b/buession-springcloud-parent/pom.xml
@@ -7,13 +7,13 @@
com.buession
parent
- 2.0.2
+ 2.1.0
com.buession.springcloud
buession-springcloud-parent
https://github.com/buession/buession-springcloud
- Buession Springcloud Framework Parent
- 2.0.2
+ Buession SpringCloud Framework Parent
+ 2.1.0
pom
@@ -48,8 +48,14 @@
https://github.com/buession/buession-springcloud
+
+ github
+ https://github.com/buession/buession-springcloud/issues
+
+
../buession-springcloud-common
+ ../buession-springcloud-bus
../buession-springcloud-config-client
../buession-springcloud-config-server
../buession-springcloud-consul
@@ -66,7 +72,9 @@
+ 2.2.9.RELEASE
2.2.8.RELEASE
+ 2.2.10.RELEASE
2.2.8.RELEASE
@@ -93,7 +101,7 @@
org.springframework.cloud
spring-cloud-commons
- 2.2.9.RELEASE
+ ${springcloud.base.version}
ch.qos.logback
@@ -104,7 +112,7 @@
org.springframework.cloud
spring-cloud-context
- 2.2.9.RELEASE
+ ${springcloud.base.version}
ch.qos.logback
@@ -117,6 +125,21 @@
spring-cloud-starter-netflix-archaius
2.2.10.RELEASE
+
+ org.springframework.cloud
+ spring-cloud-stream
+ 3.0.13.RELEASE
+
+
+ org.springframework.boot
+ spring-boot-starter-validation
+
+
+ javax.annotation
+ javax.annotation-api
+
+
+
com.netflix.netflix-commons
diff --git a/buession-springcloud-ribbon/pom.xml b/buession-springcloud-ribbon/pom.xml
index 6ac6b08..a46b244 100644
--- a/buession-springcloud-ribbon/pom.xml
+++ b/buession-springcloud-ribbon/pom.xml
@@ -7,7 +7,7 @@
com.buession.springcloud
buession-springcloud-parent
../buession-springcloud-parent
- 2.0.2
+ 2.1.0
buession-springcloud-ribbon
https://github.com/buession/buession-springcloud
@@ -46,6 +46,11 @@
https://github.com/buession/buession-springcloud
+
+ github
+ https://github.com/buession/buession-springcloud/issues
+
+
com.buession.springcloud
@@ -56,7 +61,7 @@
org.springframework.cloud
spring-cloud-starter-netflix-ribbon
- 2.2.10.RELEASE
+ ${springcloud.netflix.version}
org.springframework.boot
@@ -74,27 +79,6 @@
spring-security-rsa
-
- org.apache.httpcomponents
- httpcore
-
-
- commons-logging
- commons-logging
-
-
-
-
- org.apache.httpcomponents
- httpclient
-
-
- commons-logging
- commons-logging
-
-
-
-
com.sun.jersey
jersey-client
diff --git a/buession-springcloud-stream/pom.xml b/buession-springcloud-stream/pom.xml
index 1340730..e33e530 100644
--- a/buession-springcloud-stream/pom.xml
+++ b/buession-springcloud-stream/pom.xml
@@ -7,7 +7,7 @@
com.buession.springcloud
buession-springcloud-parent
../buession-springcloud-parent
- 2.0.2
+ 2.1.0
buession-springcloud-stream
https://github.com/buession/buession-springcloud
@@ -46,33 +46,32 @@
https://github.com/buession/buession-springcloud
+
+ github
+ https://github.com/buession/buession-springcloud/issues
+
+
com.buession.springcloud
buession-springcloud-common
${project.version}
+
+
+ org.apache.httpcomponents
+ *
+
+
org.springframework
spring-messaging
- ${springframework.version}
org.springframework.cloud
spring-cloud-stream
- 3.0.13.RELEASE
-
-
- org.springframework.boot
- spring-boot-starter-validation
-
-
- javax.annotation
- javax.annotation-api
-
-
org.springframework.cloud
diff --git a/buession-springcloud-zuul/pom.xml b/buession-springcloud-zuul/pom.xml
index 6f49669..cd3c8e0 100644
--- a/buession-springcloud-zuul/pom.xml
+++ b/buession-springcloud-zuul/pom.xml
@@ -7,7 +7,7 @@
com.buession.springcloud
buession-springcloud-parent
../buession-springcloud-parent
- 2.0.2
+ 2.1.0
buession-springcloud-zuul
https://github.com/buession/buession-springcloud
@@ -46,6 +46,11 @@
https://github.com/buession/buession-springcloud
+
+ github
+ https://github.com/buession/buession-springcloud/issues
+
+
com.buession.springcloud
@@ -80,27 +85,6 @@
jakarta.servlet-api
-
- org.apache.httpcomponents
- httpcore
-
-
- commons-logging
- commons-logging
-
-
-
-
- org.apache.httpcomponents
- httpclient
-
-
- commons-logging
- commons-logging
-
-
-
-
org.slf4j
slf4j-api