mirror of
https://gitee.com/mirrors/Spring-Cloud-Alibaba.git
synced 2021-06-26 13:25:11 +08:00
Polish alibaba/spring-cloud-alibaba#1758 : [CodeBase] Sync the source code from greenwich to finichley
This commit is contained in:
@@ -65,7 +65,7 @@ import org.springframework.web.client.RestTemplate;
|
||||
@AutoConfigureAfter(name = {
|
||||
"org.springframework.cloud.client.loadbalancer.LoadBalancerAutoConfiguration" })
|
||||
public class DubboLoadBalancedRestTemplateAutoConfiguration implements
|
||||
BeanClassLoaderAware, ApplicationContextAware, SmartInitializingSingleton {
|
||||
BeanClassLoaderAware, ApplicationContextAware, SmartInitializingSingleton {
|
||||
|
||||
private static final Class<DubboTransported> DUBBO_TRANSPORTED_CLASS = DubboTransported.class;
|
||||
|
||||
@@ -111,7 +111,8 @@ public class DubboLoadBalancedRestTemplateAutoConfiguration implements
|
||||
@Override
|
||||
public void afterSingletonsInstantiated() {
|
||||
loadBalancerInterceptorBean = retryLoadBalancerInterceptor != null
|
||||
? retryLoadBalancerInterceptor : loadBalancerInterceptor;
|
||||
? retryLoadBalancerInterceptor
|
||||
: loadBalancerInterceptor;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -145,7 +146,7 @@ public class DubboLoadBalancedRestTemplateAutoConfiguration implements
|
||||
* Gets the annotation attributes {@link RestTemplate} bean being annotated
|
||||
* {@link DubboTransported @DubboTransported}.
|
||||
* @param beanName the bean name of {@link LoadBalanced @LoadBalanced}
|
||||
* {@link RestTemplate}
|
||||
* {@link RestTemplate}
|
||||
* @param attributesResolver {@link DubboTransportedAttributesResolver}
|
||||
* @return non-null {@link Map}
|
||||
*/
|
||||
@@ -170,11 +171,11 @@ public class DubboLoadBalancedRestTemplateAutoConfiguration implements
|
||||
* {@link LoadBalancerInterceptor} Bean.
|
||||
* @param restTemplate {@link LoadBalanced @LoadBalanced} {@link RestTemplate} Bean
|
||||
* @param dubboTranslatedAttributes the annotation dubboTranslatedAttributes
|
||||
* {@link RestTemplate} bean being annotated
|
||||
* {@link DubboTransported @DubboTransported}
|
||||
* {@link RestTemplate} bean being annotated
|
||||
* {@link DubboTransported @DubboTransported}
|
||||
*/
|
||||
private void adaptRestTemplate(RestTemplate restTemplate,
|
||||
Map<String, Object> dubboTranslatedAttributes) {
|
||||
Map<String, Object> dubboTranslatedAttributes) {
|
||||
|
||||
List<ClientHttpRequestInterceptor> interceptors = new ArrayList<>(
|
||||
restTemplate.getInterceptors());
|
||||
|
@@ -47,9 +47,9 @@ public class DubboOpenFeignAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
public TargeterBeanPostProcessor targeterBeanPostProcessor(Environment environment,
|
||||
DubboServiceMetadataRepository dubboServiceMetadataRepository,
|
||||
DubboGenericServiceFactory dubboGenericServiceFactory,
|
||||
DubboGenericServiceExecutionContextFactory contextFactory) {
|
||||
DubboServiceMetadataRepository dubboServiceMetadataRepository,
|
||||
DubboGenericServiceFactory dubboGenericServiceFactory,
|
||||
DubboGenericServiceExecutionContextFactory contextFactory) {
|
||||
return new TargeterBeanPostProcessor(environment, dubboServiceMetadataRepository,
|
||||
dubboGenericServiceFactory, contextFactory);
|
||||
}
|
||||
|
@@ -350,7 +350,7 @@ public class DubboServiceDiscoveryAutoConfiguration {
|
||||
private final ThreadLocal<String> processedServiceNameThreadLocal;
|
||||
|
||||
ZookeeperConfiguration(ZookeeperDiscoveryProperties zookeeperDiscoveryProperties,
|
||||
ZookeeperServiceWatch zookeeperServiceWatch) {
|
||||
ZookeeperServiceWatch zookeeperServiceWatch) {
|
||||
this.zookeeperServiceWatch = zookeeperServiceWatch;
|
||||
this.rootPath = zookeeperDiscoveryProperties.getRoot();
|
||||
this.pathMatcher = new AntPathMatcher(NODE_PATH_SEPARATOR);
|
||||
|
@@ -43,7 +43,7 @@ public class MissingSpringCloudRegistryConfigPropertyCondition
|
||||
|
||||
@Override
|
||||
public ConditionOutcome getMatchOutcome(ConditionContext context,
|
||||
AnnotatedTypeMetadata metadata) {
|
||||
AnnotatedTypeMetadata metadata) {
|
||||
ConfigurableEnvironment environment = (ConfigurableEnvironment) context
|
||||
.getEnvironment();
|
||||
|
||||
|
@@ -42,7 +42,7 @@ class DubboClientHttpResponse implements ClientHttpResponse {
|
||||
private final DubboHttpOutputMessage httpOutputMessage;
|
||||
|
||||
DubboClientHttpResponse(DubboHttpOutputMessage httpOutputMessage,
|
||||
GenericException exception) {
|
||||
GenericException exception) {
|
||||
this.httpStatus = exception != null ? HttpStatus.INTERNAL_SERVER_ERROR
|
||||
: HttpStatus.OK;
|
||||
this.statusText = exception != null ? exception.getExceptionMessage()
|
||||
|
@@ -45,7 +45,7 @@ class DubboClientHttpResponseFactory {
|
||||
}
|
||||
|
||||
public ClientHttpResponse build(Object result, GenericException exception,
|
||||
RequestMetadata requestMetadata, RestMethodMetadata restMethodMetadata) {
|
||||
RequestMetadata requestMetadata, RestMethodMetadata restMethodMetadata) {
|
||||
|
||||
DubboHttpOutputMessage httpOutputMessage = new DubboHttpOutputMessage();
|
||||
|
||||
|
@@ -43,7 +43,7 @@ public class DubboMetadataInitializerInterceptor implements ClientHttpRequestInt
|
||||
|
||||
@Override
|
||||
public ClientHttpResponse intercept(HttpRequest request, byte[] body,
|
||||
ClientHttpRequestExecution execution) throws IOException {
|
||||
ClientHttpRequestExecution execution) throws IOException {
|
||||
|
||||
URI originalUri = request.getURI();
|
||||
|
||||
|
@@ -66,11 +66,11 @@ public class DubboTransporterInterceptor implements ClientHttpRequestInterceptor
|
||||
private final PathMatcher pathMatcher = new AntPathMatcher();
|
||||
|
||||
public DubboTransporterInterceptor(
|
||||
DubboServiceMetadataRepository dubboServiceMetadataRepository,
|
||||
List<HttpMessageConverter<?>> messageConverters, ClassLoader classLoader,
|
||||
Map<String, Object> dubboTranslatedAttributes,
|
||||
DubboGenericServiceFactory serviceFactory,
|
||||
DubboGenericServiceExecutionContextFactory contextFactory) {
|
||||
DubboServiceMetadataRepository dubboServiceMetadataRepository,
|
||||
List<HttpMessageConverter<?>> messageConverters, ClassLoader classLoader,
|
||||
Map<String, Object> dubboTranslatedAttributes,
|
||||
DubboGenericServiceFactory serviceFactory,
|
||||
DubboGenericServiceExecutionContextFactory contextFactory) {
|
||||
this.repository = dubboServiceMetadataRepository;
|
||||
this.dubboTranslatedAttributes = dubboTranslatedAttributes;
|
||||
this.clientHttpResponseFactory = new DubboClientHttpResponseFactory(
|
||||
@@ -81,7 +81,7 @@ public class DubboTransporterInterceptor implements ClientHttpRequestInterceptor
|
||||
|
||||
@Override
|
||||
public ClientHttpResponse intercept(HttpRequest request, byte[] body,
|
||||
ClientHttpRequestExecution execution) throws IOException {
|
||||
ClientHttpRequestExecution execution) throws IOException {
|
||||
|
||||
URI originalUri = request.getURI();
|
||||
|
||||
@@ -125,7 +125,7 @@ public class DubboTransporterInterceptor implements ClientHttpRequestInterceptor
|
||||
}
|
||||
|
||||
protected void customizeRequest(MutableHttpServerRequest httpServerRequest,
|
||||
RestMethodMetadata dubboRestMethodMetadata, RequestMetadata clientMetadata) {
|
||||
RestMethodMetadata dubboRestMethodMetadata, RequestMetadata clientMetadata) {
|
||||
|
||||
RequestMetadata dubboRequestMetadata = dubboRestMethodMetadata.getRequest();
|
||||
String pathPattern = dubboRequestMetadata.getPath();
|
||||
|
@@ -84,7 +84,7 @@ public class DubboNonWebApplicationEnvironmentPostProcessor
|
||||
|
||||
@Override
|
||||
public void postProcessEnvironment(ConfigurableEnvironment environment,
|
||||
SpringApplication application) {
|
||||
SpringApplication application) {
|
||||
WebApplicationType webApplicationType = application.getWebApplicationType();
|
||||
|
||||
if (!WebApplicationType.NONE.equals(webApplicationType)) { // Just works in
|
||||
@@ -117,7 +117,7 @@ public class DubboNonWebApplicationEnvironmentPostProcessor
|
||||
* @param defaultProperties defaultProperties
|
||||
*/
|
||||
private void resetServerPort(ConfigurableEnvironment environment,
|
||||
Map<String, Object> defaultProperties) {
|
||||
Map<String, Object> defaultProperties) {
|
||||
|
||||
String serverPort = environment.getProperty(SERVER_PORT_PROPERTY_NAME,
|
||||
environment.getProperty(PORT_PROPERTY_NAME));
|
||||
@@ -141,7 +141,8 @@ public class DubboNonWebApplicationEnvironmentPostProcessor
|
||||
DEFAULT_PROTOCOL);
|
||||
|
||||
return isRestProtocol(protocol)
|
||||
? environment.getProperty(PROTOCOL_PORT_PROPERTY_NAME) : null;
|
||||
? environment.getProperty(PROTOCOL_PORT_PROPERTY_NAME)
|
||||
: null;
|
||||
}
|
||||
|
||||
private String getRestPortFromProtocolsProperties(
|
||||
@@ -181,7 +182,7 @@ public class DubboNonWebApplicationEnvironmentPostProcessor
|
||||
}
|
||||
|
||||
private void setServerPort(ConfigurableEnvironment environment, String serverPort,
|
||||
Map<String, Object> defaultProperties) {
|
||||
Map<String, Object> defaultProperties) {
|
||||
if (serverPort == null) {
|
||||
return;
|
||||
}
|
||||
@@ -196,7 +197,7 @@ public class DubboNonWebApplicationEnvironmentPostProcessor
|
||||
* @param map Default Dubbo Properties
|
||||
*/
|
||||
private void addOrReplace(MutablePropertySources propertySources,
|
||||
Map<String, Object> map) {
|
||||
Map<String, Object> map) {
|
||||
MapPropertySource target = null;
|
||||
if (propertySources.contains(PROPERTY_SOURCE_NAME)) {
|
||||
PropertySource<?> source = propertySources.get(PROPERTY_SOURCE_NAME);
|
||||
|
@@ -31,7 +31,7 @@ public class HttpMessageConverterHolder {
|
||||
private final HttpMessageConverter<?> converter;
|
||||
|
||||
public HttpMessageConverterHolder(MediaType mediaType,
|
||||
HttpMessageConverter<?> converter) {
|
||||
HttpMessageConverter<?> converter) {
|
||||
this.mediaType = mediaType;
|
||||
this.converter = converter;
|
||||
}
|
||||
|
@@ -41,7 +41,7 @@ public class HttpRequestConsumersMatcher extends AbstractHttpRequestMatcher {
|
||||
/**
|
||||
* Creates a new instance from 0 or more "consumes" expressions.
|
||||
* @param consumes consumes expressions if 0 expressions are provided, the condition
|
||||
* will match to every request
|
||||
* will match to every request
|
||||
*/
|
||||
public HttpRequestConsumersMatcher(String... consumes) {
|
||||
this(consumes, null);
|
||||
@@ -69,7 +69,7 @@ public class HttpRequestConsumersMatcher extends AbstractHttpRequestMatcher {
|
||||
}
|
||||
|
||||
private static Set<ConsumeMediaTypeExpression> parseExpressions(String[] consumes,
|
||||
String[] headers) {
|
||||
String[] headers) {
|
||||
Set<ConsumeMediaTypeExpression> result = new LinkedHashSet<>();
|
||||
if (headers != null) {
|
||||
for (String header : headers) {
|
||||
|
@@ -34,10 +34,10 @@ public class HttpRequestParamsMatcher extends AbstractHttpRequestMatcher {
|
||||
|
||||
/**
|
||||
* @param params The pattern of params :
|
||||
* <ul>
|
||||
* <li>name=value</li>
|
||||
* <li>name</li>
|
||||
* </ul>
|
||||
* <ul>
|
||||
* <li>name=value</li>
|
||||
* <li>name</li>
|
||||
* </ul>
|
||||
*/
|
||||
public HttpRequestParamsMatcher(String... params) {
|
||||
this.expressions = parseExpressions(params);
|
||||
|
@@ -59,7 +59,7 @@ public class HttpMessageConverterResolver {
|
||||
}
|
||||
|
||||
public HttpMessageConverterHolder resolve(HttpRequest request,
|
||||
Class<?> parameterType) {
|
||||
Class<?> parameterType) {
|
||||
|
||||
HttpMessageConverterHolder httpMessageConverterHolder = null;
|
||||
|
||||
@@ -100,7 +100,7 @@ public class HttpMessageConverterResolver {
|
||||
* @return instance of {@link HttpMessageConverterHolder}
|
||||
*/
|
||||
public HttpMessageConverterHolder resolve(RequestMetadata requestMetadata,
|
||||
RestMethodMetadata restMethodMetadata) {
|
||||
RestMethodMetadata restMethodMetadata) {
|
||||
|
||||
HttpMessageConverterHolder httpMessageConverterHolder = null;
|
||||
|
||||
@@ -190,7 +190,7 @@ public class HttpMessageConverterResolver {
|
||||
* @return non-null {@link List}
|
||||
*/
|
||||
private List<MediaType> getProducibleMediaTypes(RestMethodMetadata restMethodMetadata,
|
||||
Class<?> returnValueClass) {
|
||||
Class<?> returnValueClass) {
|
||||
RequestMetadata serverRequestMetadata = restMethodMetadata.getRequest();
|
||||
List<MediaType> mediaTypes = serverRequestMetadata.getProduceMediaTypes();
|
||||
if (!CollectionUtils.isEmpty(mediaTypes)) { // Empty
|
||||
@@ -232,7 +232,7 @@ public class HttpMessageConverterResolver {
|
||||
* q-value of the former.
|
||||
*/
|
||||
private MediaType getMostSpecificMediaType(MediaType acceptType,
|
||||
MediaType produceType) {
|
||||
MediaType produceType) {
|
||||
MediaType produceTypeToUse = produceType.copyQualityValue(acceptType);
|
||||
return (MediaType.SPECIFICITY_COMPARATOR.compare(acceptType,
|
||||
produceTypeToUse) <= 0 ? acceptType : produceTypeToUse);
|
||||
|
@@ -244,7 +244,7 @@ public abstract class HttpUtils {
|
||||
}
|
||||
|
||||
private static void addParam(MultiValueMap<String, String> paramsMap, String name,
|
||||
String value) {
|
||||
String value) {
|
||||
String paramValue = trimAllWhitespace(value);
|
||||
if (!StringUtils.hasText(paramValue)) {
|
||||
paramValue = EMPTY_VALUE;
|
||||
|
@@ -30,7 +30,7 @@ public class DubboRestServiceMetadata {
|
||||
private final RestMethodMetadata restMethodMetadata;
|
||||
|
||||
public DubboRestServiceMetadata(ServiceRestMetadata serviceRestMetadata,
|
||||
RestMethodMetadata restMethodMetadata) {
|
||||
RestMethodMetadata restMethodMetadata) {
|
||||
this.serviceRestMetadata = serviceRestMetadata;
|
||||
this.restMethodMetadata = restMethodMetadata;
|
||||
}
|
||||
|
@@ -73,7 +73,7 @@ public class MethodMetadata {
|
||||
}
|
||||
|
||||
private MethodParameterMetadata toMethodParameterMetadata(int index,
|
||||
Parameter parameter) {
|
||||
Parameter parameter) {
|
||||
MethodParameterMetadata metadata = new MethodParameterMetadata();
|
||||
metadata.setIndex(index);
|
||||
metadata.setName(parameter.getName());
|
||||
|
@@ -111,7 +111,7 @@ public class RequestMetadata {
|
||||
}
|
||||
|
||||
private static void mediaTypes(HttpHeaders httpHeaders, String headerName,
|
||||
Collection<String> destination) {
|
||||
Collection<String> destination) {
|
||||
List<String> value = httpHeaders.get(headerName);
|
||||
List<MediaType> mediaTypes = parseMediaTypes(value);
|
||||
destination.addAll(toMediaTypeValues(mediaTypes));
|
||||
|
@@ -397,7 +397,7 @@ public class DubboServiceMetadataRepository
|
||||
}
|
||||
|
||||
public Integer getDubboProtocolPort(ServiceInstance serviceInstance,
|
||||
String protocol) {
|
||||
String protocol) {
|
||||
return dubboMetadataUtils.getDubboProtocolPort(serviceInstance, protocol);
|
||||
}
|
||||
|
||||
|
@@ -138,7 +138,7 @@ public class DubboServiceBeanMetadataResolver
|
||||
}
|
||||
|
||||
private List<MethodMetadata> parseAndValidateMetadata(Contract contract,
|
||||
Class<?> targetType) {
|
||||
Class<?> targetType) {
|
||||
List<MethodMetadata> methodMetadataList = Collections.emptyList();
|
||||
try {
|
||||
methodMetadataList = contract.parseAndValidatateMetadata(targetType);
|
||||
@@ -171,7 +171,7 @@ public class DubboServiceBeanMetadataResolver
|
||||
}
|
||||
|
||||
protected RestMethodMetadata resolveMethodRestMetadata(MethodMetadata methodMetadata,
|
||||
Class<?> targetType, List<Method> feignContractMethods) {
|
||||
Class<?> targetType, List<Method> feignContractMethods) {
|
||||
String configKey = methodMetadata.configKey();
|
||||
Method feignContractMethod = getMatchedFeignContractMethod(targetType,
|
||||
feignContractMethods, configKey);
|
||||
|
@@ -49,7 +49,7 @@ public class DubboTransportedMethodMetadataResolver {
|
||||
private final Contract contract;
|
||||
|
||||
public DubboTransportedMethodMetadataResolver(PropertyResolver propertyResolver,
|
||||
Contract contract) {
|
||||
Contract contract) {
|
||||
this.attributesResolver = new DubboTransportedAttributesResolver(
|
||||
propertyResolver);
|
||||
this.contract = contract;
|
||||
|
@@ -50,9 +50,9 @@ public class TargeterBeanPostProcessor
|
||||
private ClassLoader classLoader;
|
||||
|
||||
public TargeterBeanPostProcessor(Environment environment,
|
||||
DubboServiceMetadataRepository dubboServiceMetadataRepository,
|
||||
DubboGenericServiceFactory dubboGenericServiceFactory,
|
||||
DubboGenericServiceExecutionContextFactory contextFactory) {
|
||||
DubboServiceMetadataRepository dubboServiceMetadataRepository,
|
||||
DubboGenericServiceFactory dubboGenericServiceFactory,
|
||||
DubboGenericServiceExecutionContextFactory contextFactory) {
|
||||
this.environment = environment;
|
||||
this.dubboServiceMetadataRepository = dubboServiceMetadataRepository;
|
||||
this.dubboGenericServiceFactory = dubboGenericServiceFactory;
|
||||
|
@@ -98,7 +98,7 @@ class TargeterInvocationHandler implements InvocationHandler {
|
||||
}
|
||||
|
||||
private Object createDubboProxyIfRequired(FeignContext feignContext, Target target,
|
||||
Object defaultProxy) {
|
||||
Object defaultProxy) {
|
||||
|
||||
DubboInvocationHandler dubboInvocationHandler = createDubboInvocationHandler(
|
||||
feignContext, target, defaultProxy);
|
||||
@@ -112,7 +112,7 @@ class TargeterInvocationHandler implements InvocationHandler {
|
||||
}
|
||||
|
||||
private DubboInvocationHandler createDubboInvocationHandler(FeignContext feignContext,
|
||||
Target target, Object defaultFeignClientProxy) {
|
||||
Target target, Object defaultFeignClientProxy) {
|
||||
|
||||
// Service name equals @FeignClient.name()
|
||||
String serviceName = target.name();
|
||||
@@ -153,7 +153,7 @@ class TargeterInvocationHandler implements InvocationHandler {
|
||||
}
|
||||
|
||||
private Map<Method, FeignMethodMetadata> getFeignMethodMetadataMap(String serviceName,
|
||||
Map<DubboTransportedMethodMetadata, RestMethodMetadata> feignRestMethodMetadataMap) {
|
||||
Map<DubboTransportedMethodMetadata, RestMethodMetadata> feignRestMethodMetadataMap) {
|
||||
Map<Method, FeignMethodMetadata> feignMethodMetadataMap = new HashMap<>();
|
||||
|
||||
for (Map.Entry<DubboTransportedMethodMetadata, RestMethodMetadata> entry : feignRestMethodMetadataMap
|
||||
|
@@ -99,10 +99,10 @@ public abstract class AbstractSpringCloudRegistry extends FailbackRegistry {
|
||||
private final ConfigurableApplicationContext applicationContext;
|
||||
|
||||
public AbstractSpringCloudRegistry(URL url, DiscoveryClient discoveryClient,
|
||||
DubboServiceMetadataRepository dubboServiceMetadataRepository,
|
||||
DubboMetadataServiceProxy dubboMetadataConfigServiceProxy,
|
||||
JSONUtils jsonUtils, DubboGenericServiceFactory dubboGenericServiceFactory,
|
||||
ConfigurableApplicationContext applicationContext) {
|
||||
DubboServiceMetadataRepository dubboServiceMetadataRepository,
|
||||
DubboMetadataServiceProxy dubboMetadataConfigServiceProxy,
|
||||
JSONUtils jsonUtils, DubboGenericServiceFactory dubboGenericServiceFactory,
|
||||
ConfigurableApplicationContext applicationContext) {
|
||||
super(url);
|
||||
this.servicesLookupInterval = url
|
||||
.getParameter(SERVICES_LOOKUP_INTERVAL_PARAM_NAME, 60L);
|
||||
@@ -356,7 +356,7 @@ public abstract class AbstractSpringCloudRegistry extends FailbackRegistry {
|
||||
}
|
||||
|
||||
private List<URL> getExportedURLs(DubboMetadataService dubboMetadataService,
|
||||
URL url) {
|
||||
URL url) {
|
||||
String serviceInterface = url.getServiceInterface();
|
||||
String group = url.getParameter(GROUP_KEY);
|
||||
String version = url.getParameter(VERSION_KEY);
|
||||
|
@@ -109,10 +109,10 @@ public class DubboCloudRegistry extends FailbackRegistry {
|
||||
private final String currentApplicationName;
|
||||
|
||||
public DubboCloudRegistry(URL url, DiscoveryClient discoveryClient,
|
||||
DubboServiceMetadataRepository repository,
|
||||
DubboMetadataServiceProxy dubboMetadataConfigServiceProxy,
|
||||
JSONUtils jsonUtils, DubboGenericServiceFactory dubboGenericServiceFactory,
|
||||
ConfigurableApplicationContext applicationContext) {
|
||||
DubboServiceMetadataRepository repository,
|
||||
DubboMetadataServiceProxy dubboMetadataConfigServiceProxy,
|
||||
JSONUtils jsonUtils, DubboGenericServiceFactory dubboGenericServiceFactory,
|
||||
ConfigurableApplicationContext applicationContext) {
|
||||
|
||||
super(url);
|
||||
this.servicesLookupInterval = url
|
||||
@@ -415,7 +415,7 @@ public class DubboCloudRegistry extends FailbackRegistry {
|
||||
}
|
||||
|
||||
private List<URL> getExportedURLs(DubboMetadataService dubboMetadataService,
|
||||
URL subscribedURL) {
|
||||
URL subscribedURL) {
|
||||
String serviceInterface = subscribedURL.getServiceInterface();
|
||||
String group = subscribedURL.getParameter(GROUP_KEY);
|
||||
String version = subscribedURL.getParameter(VERSION_KEY);
|
||||
|
@@ -40,10 +40,10 @@ public class SpringCloudRegistry extends AbstractSpringCloudRegistry {
|
||||
private final DubboServiceMetadataRepository dubboServiceMetadataRepository;
|
||||
|
||||
public SpringCloudRegistry(URL url, DiscoveryClient discoveryClient,
|
||||
DubboServiceMetadataRepository dubboServiceMetadataRepository,
|
||||
DubboMetadataServiceProxy dubboMetadataConfigServiceProxy,
|
||||
JSONUtils jsonUtils, DubboGenericServiceFactory dubboGenericServiceFactory,
|
||||
ConfigurableApplicationContext applicationContext) {
|
||||
DubboServiceMetadataRepository dubboServiceMetadataRepository,
|
||||
DubboMetadataServiceProxy dubboMetadataConfigServiceProxy,
|
||||
JSONUtils jsonUtils, DubboGenericServiceFactory dubboGenericServiceFactory,
|
||||
ConfigurableApplicationContext applicationContext) {
|
||||
super(url, discoveryClient, dubboServiceMetadataRepository,
|
||||
dubboMetadataConfigServiceProxy, jsonUtils, dubboGenericServiceFactory,
|
||||
applicationContext);
|
||||
|
@@ -82,7 +82,7 @@ public class DubboGenericServiceFactory {
|
||||
}
|
||||
|
||||
private ReferenceBean<GenericService> build(ServiceRestMetadata serviceRestMetadata,
|
||||
Map<String, Object> dubboTranslatedAttributes) {
|
||||
Map<String, Object> dubboTranslatedAttributes) {
|
||||
String urlValue = serviceRestMetadata.getUrl();
|
||||
URL url = URL.valueOf(urlValue);
|
||||
String interfaceName = url.getServiceInterface();
|
||||
@@ -127,8 +127,7 @@ public class DubboGenericServiceFactory {
|
||||
new PropertyEditorSupport() {
|
||||
|
||||
@Override
|
||||
public void setAsText(String text)
|
||||
throws IllegalArgumentException {
|
||||
public void setAsText(String text) throws IllegalArgumentException {
|
||||
// Trim all whitespace
|
||||
String content = StringUtils.trimAllWhitespace(text);
|
||||
if (!StringUtils.hasText(content)) { // No content , ignore
|
||||
|
@@ -48,7 +48,7 @@ public abstract class AbstractNamedValueServiceParameterResolver
|
||||
|
||||
@Override
|
||||
public Object resolve(RestMethodMetadata restMethodMetadata,
|
||||
MethodParameterMetadata methodParameterMetadata, HttpServerRequest request) {
|
||||
MethodParameterMetadata methodParameterMetadata, HttpServerRequest request) {
|
||||
|
||||
Collection<String> names = getNames(restMethodMetadata, methodParameterMetadata);
|
||||
|
||||
@@ -87,8 +87,8 @@ public abstract class AbstractNamedValueServiceParameterResolver
|
||||
|
||||
@Override
|
||||
public Object resolve(RestMethodMetadata restMethodMetadata,
|
||||
MethodParameterMetadata methodParameterMetadata,
|
||||
RestMethodMetadata clientRestMethodMetadata, Object[] arguments) {
|
||||
MethodParameterMetadata methodParameterMetadata,
|
||||
RestMethodMetadata clientRestMethodMetadata, Object[] arguments) {
|
||||
|
||||
Collection<String> names = getNames(restMethodMetadata, methodParameterMetadata);
|
||||
|
||||
@@ -116,7 +116,7 @@ public abstract class AbstractNamedValueServiceParameterResolver
|
||||
}
|
||||
|
||||
protected Collection<String> getNames(RestMethodMetadata restMethodMetadata,
|
||||
MethodParameterMetadata methodParameterMetadata) {
|
||||
MethodParameterMetadata methodParameterMetadata) {
|
||||
|
||||
Map<Integer, Collection<String>> indexToName = restMethodMetadata
|
||||
.getIndexToName();
|
||||
|
@@ -38,10 +38,10 @@ public interface DubboGenericServiceParameterResolver extends Ordered {
|
||||
* @return the result of resolve
|
||||
*/
|
||||
Object resolve(RestMethodMetadata restMethodMetadata,
|
||||
MethodParameterMetadata methodParameterMetadata, HttpServerRequest request);
|
||||
MethodParameterMetadata methodParameterMetadata, HttpServerRequest request);
|
||||
|
||||
Object resolve(RestMethodMetadata restMethodMetadata,
|
||||
MethodParameterMetadata methodParameterMetadata,
|
||||
RestMethodMetadata clientRestMethodMetadata, Object[] arguments);
|
||||
MethodParameterMetadata methodParameterMetadata,
|
||||
RestMethodMetadata clientRestMethodMetadata, Object[] arguments);
|
||||
|
||||
}
|
||||
|
@@ -69,7 +69,7 @@ public class RequestBodyServiceParameterResolver
|
||||
}
|
||||
|
||||
private boolean supportParameter(RestMethodMetadata restMethodMetadata,
|
||||
MethodParameterMetadata methodParameterMetadata) {
|
||||
MethodParameterMetadata methodParameterMetadata) {
|
||||
|
||||
Integer index = methodParameterMetadata.getIndex();
|
||||
|
||||
@@ -88,7 +88,7 @@ public class RequestBodyServiceParameterResolver
|
||||
|
||||
@Override
|
||||
public Object resolve(RestMethodMetadata restMethodMetadata,
|
||||
MethodParameterMetadata methodParameterMetadata, HttpServerRequest request) {
|
||||
MethodParameterMetadata methodParameterMetadata, HttpServerRequest request) {
|
||||
|
||||
if (!supportParameter(restMethodMetadata, methodParameterMetadata)) {
|
||||
return null;
|
||||
@@ -117,8 +117,8 @@ public class RequestBodyServiceParameterResolver
|
||||
|
||||
@Override
|
||||
public Object resolve(RestMethodMetadata restMethodMetadata,
|
||||
MethodParameterMetadata methodParameterMetadata,
|
||||
RestMethodMetadata clientRestMethodMetadata, Object[] arguments) {
|
||||
MethodParameterMetadata methodParameterMetadata,
|
||||
RestMethodMetadata clientRestMethodMetadata, Object[] arguments) {
|
||||
|
||||
if (!supportParameter(restMethodMetadata, methodParameterMetadata)) {
|
||||
return null;
|
||||
|
@@ -108,7 +108,7 @@ public class DubboMetadataUtils {
|
||||
}
|
||||
|
||||
public Integer getDubboProtocolPort(ServiceInstance serviceInstance,
|
||||
String protocol) {
|
||||
String protocol) {
|
||||
String protocolProperty = getDubboProtocolPropertyName(protocol);
|
||||
Map<String, String> metadata = serviceInstance.getMetadata();
|
||||
String protocolPort = metadata.get(protocolProperty);
|
||||
|
Reference in New Issue
Block a user