[GitHub] [servicecomb-service-center] yankooo opened a new issue #674: live/produce service maybe forbid "Test Schema" feature
yankooo opened a new issue #674: URL: https://github.com/apache/servicecomb-service-center/issues/674 **Is your feature request related to a problem? Please describe.** `Test Schema` is dangerous when service is deployed in living/produce, it's will expose API. **Describe the solution you'd like** https://github.com/apache/servicecomb-service-center/blob/1182bc1aab1421f593221602d6da2fc61760d800/frontend/schema/schemahandler.go#L76 maybe has a config can forbid this feature in live environment? This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [servicecomb-java-chassis] liyupeisleep commented on issue #1910: 实例隔离没有生效
liyupeisleep commented on issue #1910: URL: https://github.com/apache/servicecomb-java-chassis/issues/1910#issuecomment-668918076 > 实例被隔离会打印日志和[发送隔离事件](https://docs.servicecomb.io/java-chassis/zh_CN/general-development/AlarmEvent/) > > 有一定的请求到 B , 我估计是因为 singleTestTime 的原因, 这个隔离时间较短, 5秒中可能尝试访问这个被隔离的实例一次。 请问日志关键字是啥,我在消费端日志搜 isolation没结果 This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [servicecomb-java-chassis] liubao68 commented on a change in pull request #1909: [SCB-2057] set the AppId, ServiceName, Version information by reading…
liubao68 commented on a change in pull request #1909: URL: https://github.com/apache/servicecomb-java-chassis/pull/1909#discussion_r465413381 ## File path: foundations/foundation-registry/src/main/java/org/apache/servicecomb/registry/api/registry/MicroserviceFactory.java ## @@ -49,14 +54,33 @@ public Microservice create(MicroserviceDefinition microserviceDefinition) { private Microservice createMicroserviceFromDefinition(Configuration configuration) { Microservice microservice = new Microservice(); - microservice.setServiceName(configuration.getString(CONFIG_QUALIFIED_MICROSERVICE_NAME_KEY, -DEFAULT_MICROSERVICE_NAME)); -microservice.setAppId(configuration.getString(CONFIG_APPLICATION_ID_KEY, DefinitionConst.DEFAULT_APPLICATION_ID)); -String version = configuration.getString(CONFIG_QUALIFIED_MICROSERVICE_VERSION_KEY, -DefinitionConst.DEFAULT_MICROSERVICE_VERSION); -// just check version format -new Version(version); -microservice.setVersion(version); + +EnvironmentConfiguration envConfig = new EnvironmentConfiguration(); +if (!StringUtils.isEmpty(envConfig.getString(APP_MAPPING)) && + !StringUtils.isEmpty(envConfig.getString(envConfig.getString(APP_MAPPING { + microservice.setAppId(envConfig.getString(envConfig.getString(APP_MAPPING))); +} else { + microservice.setAppId(configuration + .getString(CONFIG_APPLICATION_ID_KEY, DefinitionConst.DEFAULT_APPLICATION_ID)); +} +if (!StringUtils.isEmpty(envConfig.getString(SERVICE_MAPPING)) && + !StringUtils.isEmpty(envConfig.getString(envConfig.getString(SERVICE_MAPPING { + microservice.setServiceName(envConfig.getString(envConfig.getString(SERVICE_MAPPING))); +} else { + microservice.setServiceName(configuration.getString(CONFIG_QUALIFIED_MICROSERVICE_NAME_KEY, + DEFAULT_MICROSERVICE_NAME)); +} +if (!StringUtils.isEmpty(envConfig.getString(VERSION_MAPPING)) && + !StringUtils.isEmpty(envConfig.getString(envConfig.getString(VERSION_MAPPING { + microservice.setVersion(envConfig.getString(envConfig.getString(VERSION_MAPPING))); +} else { + // just check version format + String version = configuration.getString(CONFIG_QUALIFIED_MICROSERVICE_VERSION_KEY, + DefinitionConst.DEFAULT_MICROSERVICE_VERSION); + new Version(version); Review comment: version check can be done in setter, or easily missed checking when setting. e.g. for environment, this check is missed. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [servicecomb-java-chassis] yhs0092 commented on a change in pull request #1907: [SCB-2058] fix SpringMVC provider not support non-file-type RequestPart problem
yhs0092 commented on a change in pull request #1907: URL: https://github.com/apache/servicecomb-java-chassis/pull/1907#discussion_r465411794 ## File path: swagger/swagger-generator/generator-springmvc/src/main/java/org/apache/servicecomb/swagger/generator/springmvc/processor/annotation/RequestPartAnnotationProcessor.java ## @@ -56,11 +57,34 @@ public HttpParameterType getHttpParameterType(RequestPart parameterAnnotation) { @Override public void fillParameter(Swagger swagger, Operation operation, FormParameter formParameter, Type type, RequestPart requestPart) { -Property property = new FileProperty(); -if (TypeFactory.defaultInstance().constructType(type).isContainerType()) { - property = new ArrayProperty(new FileProperty()); -} +Property property = resolveParamProperty(type); Review comment: Done This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[servicecomb-java-chassis] 01/02: [SCB-2058] fix SpringMVC provider not support non-file-type RequestPart problem
This is an automated email from the ASF dual-hosted git repository. liubao pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/servicecomb-java-chassis.git commit 09746aac548b73a8b472183625a591c586b3c52e Author: yhs0092 AuthorDate: Mon Aug 3 19:13:18 2020 +0800 [SCB-2058] fix SpringMVC provider not support non-file-type RequestPart problem - add MultipartFilePropertyCreator to enable ModelConverters resolving MultipartFile param - make RequestPartAnnotationProcessor recognize non-file-type RequestPart param --- .../apache/servicecomb/it/testcase/TestUpload.java | 82 ++ .../servicecomb/it/schema/UploadJaxrsSchema.java | 30 .../it/schema/UploadSpringmvcSchema.java | 15 ++ .../annotation/RequestPartAnnotationProcessor.java | 34 - .../creator/MultipartFilePropertyCreator.java | 38 + ...swagger.extend.property.creator.PropertyCreator | 18 +++ .../RequestPartAnnotationProcessorTest.java| 169 + .../creator/MultipartFilePropertyCreatorTest.java | 42 + 8 files changed, 423 insertions(+), 5 deletions(-) diff --git a/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/TestUpload.java b/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/TestUpload.java index 8aede2f..57a7a88 100644 --- a/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/TestUpload.java +++ b/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/TestUpload.java @@ -20,19 +20,25 @@ import java.io.File; import java.io.IOException; import java.nio.charset.StandardCharsets; import java.util.ArrayList; +import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; import org.apache.commons.io.FileUtils; import org.apache.servicecomb.it.Consumers; +import org.hamcrest.Matchers; import org.junit.Assert; import org.junit.Before; import org.junit.Test; +import org.springframework.core.ParameterizedTypeReference; import org.springframework.core.io.FileSystemResource; +import org.springframework.core.io.Resource; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpMethod; import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; public class TestUpload { @@ -47,6 +53,10 @@ public class TestUpload { private static final String message = "cseMessage"; interface UploadIntf { +Map uploadMultiformMix(Resource file, +List fileList, +String str, +List strList); } private static Consumers consumersSpringmvc = new Consumers<>("uploadSpringmvcSchema", @@ -316,6 +326,78 @@ public class TestUpload { Assert.assertTrue(containsAll(result, "hello1", "cse4", "cse3", "中文 2", message)); } + @Test + public void testUploadMultiformMix_RestTemplate_SpringMVC() { +Map map = new HashMap<>(); +List fileList = new ArrayList<>(); +fileList.add(fileSystemResource2); +map.put("file", fileSystemResource1); +map.put("fileList", fileList); +map.put("str", message); +map.put("strList", Collections.singletonList("2.中文测试")); +HttpHeaders headers = new HttpHeaders(); +headers.setContentType(MediaType.MULTIPART_FORM_DATA); +ResponseEntity> response = + consumersSpringmvc.getSCBRestTemplate().exchange("/uploadMultiformMix", HttpMethod.POST, +new HttpEntity<>(map, headers), new ParameterizedTypeReference>() { +}); +Map responseBody = response.getBody(); +Assert.assertThat(responseBody, Matchers.notNullValue()); +Assert.assertThat(responseBody.get("file"), Matchers.is("hello1")); +Assert.assertThat(responseBody.get("fileList"), Matchers.is("中文 2")); +Assert.assertThat(responseBody.get("str"), Matchers.is("cseMessage")); +Assert.assertThat(responseBody.get("strList"), Matchers.is("[2.中文测试]")); + } + + @Test + public void testUploadMultiformMix_Rpc_SpringMVC() { +List fileList = new ArrayList<>(); +fileList.add(fileSystemResource2); +Map responseBody = +consumersSpringmvc.getIntf().uploadMultiformMix( +fileSystemResource1, fileList, message, Collections.singletonList("2.中文测试")); +Assert.assertThat(responseBody.get("file"), Matchers.is("hello1")); +Assert.assertThat(responseBody.get("fileList"), Matchers.is("中文 2")); +Assert.assertThat(responseBody.get("str"), Matchers.is("cseMessage")); +Assert.assertThat(responseBody.get("strList"), Matchers.is("[2.中文测试]")); + } + + @Test + public void testUploadMultiformMix_RestTemplate_JAXRS() { +Map map = new HashMap<>(); +List fileList = new ArrayList<>(); +fileList.add(fileSystemResource2); +map.put("file", fileSystemResource1); +map.put("fileList", fileList); +map.put("str", message); +map.put("strList",
[servicecomb-java-chassis] 02/02: [SCB-2058] make RequestPartAnnotationProcessor extend AbstractSpringmvcSerializableParameterProcessor
This is an automated email from the ASF dual-hosted git repository. liubao pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/servicecomb-java-chassis.git commit cb47f4c31fee7468ef5d8cfe0aed2d53a73d08cd Author: yhs0092 AuthorDate: Tue Aug 4 16:50:09 2020 +0800 [SCB-2058] make RequestPartAnnotationProcessor extend AbstractSpringmvcSerializableParameterProcessor --- .../annotation/RequestPartAnnotationProcessor.java | 47 -- 1 file changed, 7 insertions(+), 40 deletions(-) diff --git a/swagger/swagger-generator/generator-springmvc/src/main/java/org/apache/servicecomb/swagger/generator/springmvc/processor/annotation/RequestPartAnnotationProcessor.java b/swagger/swagger-generator/generator-springmvc/src/main/java/org/apache/servicecomb/swagger/generator/springmvc/processor/annotation/RequestPartAnnotationProcessor.java index 3041527..aade823 100644 --- a/swagger/swagger-generator/generator-springmvc/src/main/java/org/apache/servicecomb/swagger/generator/springmvc/processor/annotation/RequestPartAnnotationProcessor.java +++ b/swagger/swagger-generator/generator-springmvc/src/main/java/org/apache/servicecomb/swagger/generator/springmvc/processor/annotation/RequestPartAnnotationProcessor.java @@ -19,22 +19,13 @@ package org.apache.servicecomb.swagger.generator.springmvc.processor.annotation; import java.lang.reflect.Type; -import org.apache.servicecomb.swagger.generator.ParameterProcessor; import org.apache.servicecomb.swagger.generator.core.model.HttpParameterType; import org.springframework.web.bind.annotation.RequestPart; -import com.fasterxml.jackson.databind.JavaType; -import com.fasterxml.jackson.databind.type.TypeFactory; - -import io.swagger.converter.ModelConverters; -import io.swagger.models.Operation; -import io.swagger.models.Swagger; import io.swagger.models.parameters.FormParameter; -import io.swagger.models.properties.ArrayProperty; -import io.swagger.models.properties.Property; -public class RequestPartAnnotationProcessor implements -ParameterProcessor { +public class RequestPartAnnotationProcessor extends +AbstractSpringmvcSerializableParameterProcessor { @Override public Type getProcessType() { return RequestPart.class; @@ -55,36 +46,12 @@ public class RequestPartAnnotationProcessor implements } @Override - public void fillParameter(Swagger swagger, Operation operation, FormParameter formParameter, Type type, - RequestPart requestPart) { -Property property = resolveParamProperty(type); - -formParameter.setProperty(property); -formParameter.setRequired(requestPart.required()); + protected boolean readRequired(RequestPart requestPart) { +return requestPart.required(); } - private Property resolveParamProperty(Type type) { -JavaType javaType = TypeFactory.defaultInstance().constructType(type); -if (javaType.isContainerType()) { - return resolvePropertyAsContainerType(javaType); -} -return ModelConverters.getInstance().readAsProperty(type); - } - - private Property resolvePropertyAsContainerType(JavaType javaType) { -// At present, only array and collection of Part params are supported, -// but Map type is also a kind of container type. -// Although Map is not supported now, we still consider to take the type of value to generate a property. -// Therefore, here we use lastContainedTypeIndex to get the contained type. -int lastContainedTypeIndex = javaType.containedTypeCount() - 1; -JavaType containedItemType; -if (lastContainedTypeIndex < 0) { - // javaType may be an array - containedItemType = javaType.getContentType(); -} else { - containedItemType = javaType.containedType(lastContainedTypeIndex); -} -Property containedItemProperty = ModelConverters.getInstance().readAsProperty(containedItemType); -return new ArrayProperty(containedItemProperty); + @Override + protected String pureReadDefaultValue(RequestPart requestPart) { +return null; } }
[servicecomb-java-chassis] branch master updated (ad9516d -> cb47f4c)
This is an automated email from the ASF dual-hosted git repository. liubao pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/servicecomb-java-chassis.git. from ad9516d [SCB-1754]accessor problem fix: CseHttpMessageConverter response access new 09746aa [SCB-2058] fix SpringMVC provider not support non-file-type RequestPart problem new cb47f4c [SCB-2058] make RequestPartAnnotationProcessor extend AbstractSpringmvcSerializableParameterProcessor The 2 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: .../apache/servicecomb/it/testcase/TestUpload.java | 82 ++ .../servicecomb/it/schema/UploadJaxrsSchema.java | 30 .../it/schema/UploadSpringmvcSchema.java | 15 ++ .../annotation/RequestPartAnnotationProcessor.java | 27 ++-- .../creator/MultipartFilePropertyCreator.java} | 9 +- ...swagger.extend.property.creator.PropertyCreator | 2 +- .../RequestPartAnnotationProcessorTest.java| 169 + .../creator/MultipartFilePropertyCreatorTest.java} | 22 +-- 8 files changed, 322 insertions(+), 34 deletions(-) copy swagger/swagger-generator/{generator-core/src/main/java/org/apache/servicecomb/swagger/extend/property/creator/PartPropertyCreator.java => generator-springmvc/src/main/java/org/apache/servicecomb/swagger/generator/springmvc/property/creator/MultipartFilePropertyCreator.java} (75%) copy common/common-access-log/src/main/resources/META-INF/services/org.apache.servicecomb.core.BootListener => swagger/swagger-generator/generator-springmvc/src/main/resources/META-INF/services/org.apache.servicecomb.swagger.extend.property.creator.PropertyCreator (89%) create mode 100644 swagger/swagger-generator/generator-springmvc/src/test/java/org/apache/servicecomb/swagger/generator/springmvc/processor/annotation/RequestPartAnnotationProcessorTest.java copy swagger/swagger-generator/{generator-core/src/test/java/org/apache/servicecomb/swagger/extend/property/creator/TestPartPropertyCreator.java => generator-springmvc/src/test/java/org/apache/servicecomb/swagger/generator/springmvc/property/creator/MultipartFilePropertyCreatorTest.java} (62%)
[GitHub] [servicecomb-java-chassis] liubao68 merged pull request #1907: [SCB-2058] fix SpringMVC provider not support non-file-type RequestPart problem
liubao68 merged pull request #1907: URL: https://github.com/apache/servicecomb-java-chassis/pull/1907 This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [servicecomb-java-chassis] liubao68 commented on issue #1910: 实例隔离没有生效
liubao68 commented on issue #1910: URL: https://github.com/apache/servicecomb-java-chassis/issues/1910#issuecomment-668905630 实例被隔离会打印日志和[发送隔离事件](https://docs.servicecomb.io/java-chassis/zh_CN/general-development/AlarmEvent/) 有一定的请求到 B , 我估计是因为 singleTestTime 的原因, 这个隔离时间较短, 5秒中可能尝试访问这个被隔离的实例一次。 This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [servicecomb-java-chassis] liyupeisleep commented on issue #1910: 实例隔离没有生效
liyupeisleep commented on issue #1910: URL: https://github.com/apache/servicecomb-java-chassis/issues/1910#issuecomment-668618460 负载均衡设置的权重策略。所以看着像负载均衡的策略,B实例怎么才能判断被隔离? This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [servicecomb-java-chassis] liyupeisleep opened a new issue #1910: 实例隔离没有生效
liyupeisleep opened a new issue #1910: URL: https://github.com/apache/servicecomb-java-chassis/issues/1910 1、注册了三个服务端A、B、C,一个消费端。将消费端的实例隔离配置修改如下 ![image](https://user-images.githubusercontent.com/67566979/89303170-67085e80-d69e-11ea-937c-005677b62551.png) 2、服务端B方法内设置sleep,使其超时报490 3、一分钟内触发多次,还是会有1/10左右的概率请求到B服务,报490 2020/08/04 21:54:15 +0800||5f2968872646c812||GET /eculs/v1/41300494802/learnt-count||10.52.219.152||10.52.219.152||500||-||-||0||-||getUserLearntCount 2020/08/04 21:54:21 +0800||5f29688d952ad804||GET /eculs/v1/41300494802/learnt-count||10.52.219.152||10.52.219.152||500||-||-||0||-||getUserLearntCount 2020/08/04 21:54:27 +0800||5f296893d2969513||GET /eculs/v1/41300494802/learnt-count||10.52.219.152||10.52.219.152||500||-||-||0||-||getUserLearntCount 2020/08/04 21:54:33 +0800||5f2968993fe63b1d||GET /eculs/v1/41300494802/learnt-count||10.52.219.152||10.52.219.152||500||-||-||0||-||getUserLearntCount 2020/08/04 21:54:39 +0800||5f29689f61bcfc86||GET /eculs/v1/41300494802/learnt-count||10.52.219.152||10.52.219.152||501||-||-||0||-||getUserLearntCount 2020/08/04 21:54:45 +0800||5f2968a50dc53b72||GET /eculs/v1/41300494802/learnt-count||10.52.219.152||10.52.219.152||501||-||-||0||-||getUserLearntCount 2020/08/04 21:54:52 +0800||5f2968acb71274d0||GET /eculs/v1/41300494802/learnt-count||10.52.219.152||10.52.219.152||499||-||-||0||-||getUserLearntCount 2020/08/04 21:54:58 +0800||5f2968b25657f0ac||GET /eculs/v1/41300494802/learnt-count||10.52.219.152||10.52.219.152||501||-||-||0||-||getUserLearntCount 2020/08/04 21:55:06 +0800||5f2968bab56e7ed4||GET /eculs/v1/41300494802/learnt-count||10.52.219.152||10.52.219.152||499||-||-||0||-||getUserLearntCount 2020/08/04 21:55:13 +0800||5f2968c1fdd6fc65||GET /eculs/v1/41300494802/learnt-count||10.52.219.152||10.52.219.152||500||-||-||0||-||getUserLearntCount 2020/08/04 21:55:21 +0800||5f2968c9ffb5a219||GET /eculs/v1/41300494802/learnt-count||10.52.219.152||10.52.219.152||501||-||-||0||-||getUserLearntCount 2020/08/04 21:55:27 +0800||5f2968cfab3cc39a||GET /eculs/v1/41300494802/learnt-count||10.52.219.152||10.52.219.152||500||-||-||0||-||getUserLearntCount 2020/08/04 21:55:33 +0800||5f2968d5820c6573||GET /eculs/v1/41300494802/learnt-count||10.52.219.152||10.52.219.152||501||-||-||0||-||getUserLearntCount 2020/08/04 21:55:39 +0800||5f2968db5c7f02b1||GET /eculs/v1/41300494802/learnt-count||10.52.219.152||10.52.219.152||498||-||-||0||-||getUserLearntCount 2020/08/04 21:55:45 +0800||5f2968e1fb5bb32c||GET /eculs/v1/41300494802/learnt-count||10.52.219.152||10.52.219.152||500||-||-||0||-||getUserLearntCount 2020/08/04 21:55:51 +0800||5f2968e7f2e80ddf||GET /eculs/v1/41300494802/learnt-count||10.52.219.152||10.52.219.152||499||-||-||0||-||getUserLearntCount 2020/08/04 21:56:03 +0800||5f2968f37ea82fda||GET /eculs/v1/41300494802/learnt-count||10.52.219.152||10.52.219.152||501||-||-||0||-||getUserLearntCount 2020/08/04 21:56:10 +0800||5f2968fa13d62ef8||GET /eculs/v1/41300494802/learnt-count||10.52.219.152||10.52.219.152||498||-||-||0||-||getUserLearntCount 2020/08/04 21:56:17 +0800||5f29690162f6c189||GET /eculs/v1/41300494802/learnt-count||10.52.219.152||10.52.219.152||501||-||-||0||-||getUserLearntCount This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [servicecomb-service-center] tianxiaoliang merged pull request #673: Remove API level body limit for service registration, use global limit instead.
tianxiaoliang merged pull request #673: URL: https://github.com/apache/servicecomb-service-center/pull/673 This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[servicecomb-service-center] branch master updated: As there is parameter validation, remove API level body limit for service registration, use global limit instead. (#673)
This is an automated email from the ASF dual-hosted git repository. tianxiaoliang pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/servicecomb-service-center.git The following commit(s) were added to refs/heads/master by this push: new 1182bc1 As there is parameter validation, remove API level body limit for service registration, use global limit instead. (#673) 1182bc1 is described below commit 1182bc1aab1421f593221602d6da2fc61760d800 Author: humingcheng AuthorDate: Tue Aug 4 20:38:18 2020 +0800 As there is parameter validation, remove API level body limit for service registration, use global limit instead. (#673) --- server/handler/maxbody/maxbody.go | 8 ++-- 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/server/handler/maxbody/maxbody.go b/server/handler/maxbody/maxbody.go index 2aae8f0..58c08ad 100644 --- a/server/handler/maxbody/maxbody.go +++ b/server/handler/maxbody/maxbody.go @@ -25,15 +25,11 @@ import ( ) const ( - microserviceSize = 5 * 1024 // 5KB - instanceSize = 5 * 1024 // 5KB - propertiesSize = 3 * 1024 // 3KB + instanceSize = 5 * 1024 // 5KB + propertiesSize = 3 * 1024 // 3KB ) var resourcesMap = map[string]int64{ - "/registry/v3/microservices": microserviceSize, - "/v4/:project/registry/microservices": microserviceSize, - "/registry/v3/microservices/:serviceId/instances": instanceSize, "/v4/:project/registry/microservices/:serviceId/instances": instanceSize,
[GitHub] [servicecomb-java-chassis] coveralls edited a comment on pull request #1907: [SCB-2058] fix SpringMVC provider not support non-file-type RequestPart problem
coveralls edited a comment on pull request #1907: URL: https://github.com/apache/servicecomb-java-chassis/pull/1907#issuecomment-667997421 [![Coverage Status](https://coveralls.io/builds/32527005/badge)](https://coveralls.io/builds/32527005) Coverage increased (+0.02%) to 86.294% when pulling **64de0454a7ef64e662e9267374ff235d9a106a13 on yhs0092:SpringMVC-style-provider-not-support-non-file-type-RequestPart** into **ad9516dfad410a4162a7180336306200f410c0c1 on apache:master**. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [servicecomb-java-chassis] coveralls edited a comment on pull request #1907: [SCB-2058] fix SpringMVC provider not support non-file-type RequestPart problem
coveralls edited a comment on pull request #1907: URL: https://github.com/apache/servicecomb-java-chassis/pull/1907#issuecomment-667997421 [![Coverage Status](https://coveralls.io/builds/32526254/badge)](https://coveralls.io/builds/32526254) Coverage increased (+0.04%) to 86.31% when pulling **64de0454a7ef64e662e9267374ff235d9a106a13 on yhs0092:SpringMVC-style-provider-not-support-non-file-type-RequestPart** into **ad9516dfad410a4162a7180336306200f410c0c1 on apache:master**. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [servicecomb-java-chassis] coveralls commented on pull request #1909: [SCB-2057] set the AppId, ServiceName, Version information by reading…
coveralls commented on pull request #1909: URL: https://github.com/apache/servicecomb-java-chassis/pull/1909#issuecomment-668494106 [![Coverage Status](https://coveralls.io/builds/32524768/badge)](https://coveralls.io/builds/32524768) Coverage decreased (-0.01%) to 86.259% when pulling **a038981fd2ec2b9ff88bb1692bbfd9039b2d8486 on GuoYL123:mmaster** into **ad9516dfad410a4162a7180336306200f410c0c1 on apache:master**. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [servicecomb-java-chassis] liubao68 commented on a change in pull request #1907: [SCB-2058] fix SpringMVC provider not support non-file-type RequestPart problem
liubao68 commented on a change in pull request #1907: URL: https://github.com/apache/servicecomb-java-chassis/pull/1907#discussion_r464915999 ## File path: swagger/swagger-generator/generator-springmvc/src/main/java/org/apache/servicecomb/swagger/generator/springmvc/processor/annotation/RequestPartAnnotationProcessor.java ## @@ -56,11 +57,34 @@ public HttpParameterType getHttpParameterType(RequestPart parameterAnnotation) { @Override public void fillParameter(Swagger swagger, Operation operation, FormParameter formParameter, Type type, RequestPart requestPart) { -Property property = new FileProperty(); -if (TypeFactory.defaultInstance().constructType(type).isContainerType()) { - property = new ArrayProperty(new FileProperty()); -} +Property property = resolveParamProperty(type); Review comment: actually I mean fillParameter can call super.fillParameter, because jaxrs works fine by doing this. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [servicecomb-java-chassis] yhs0092 commented on a change in pull request #1907: [SCB-2058] fix SpringMVC provider not support non-file-type RequestPart problem
yhs0092 commented on a change in pull request #1907: URL: https://github.com/apache/servicecomb-java-chassis/pull/1907#discussion_r464903620 ## File path: swagger/swagger-generator/generator-springmvc/src/main/java/org/apache/servicecomb/swagger/generator/springmvc/processor/annotation/RequestPartAnnotationProcessor.java ## @@ -56,11 +57,34 @@ public HttpParameterType getHttpParameterType(RequestPart parameterAnnotation) { @Override public void fillParameter(Swagger swagger, Operation operation, FormParameter formParameter, Type type, RequestPart requestPart) { -Property property = new FileProperty(); -if (TypeFactory.defaultInstance().constructType(type).isContainerType()) { - property = new ArrayProperty(new FileProperty()); -} +Property property = resolveParamProperty(type); Review comment: Done, please review it. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [servicecomb-service-center] humingcheng opened a new pull request #673: Remove API level body limit for service registration, use global limit instead.
humingcheng opened a new pull request #673: URL: https://github.com/apache/servicecomb-service-center/pull/673 As there is parameter validation, remove API level body limit for service registration, use global limit instead. Follow this checklist to help us incorporate your contribution quickly and easily: - [ ] Make sure there is a [JIRA issue](https://issues.apache.org/jira/browse/SCB) filed for the change (usually before you start working on it). Trivial changes like typos do not require a JIRA issue. Your pull request should address just this issue, without pulling in other changes. - [ ] Each commit in the pull request should have a meaningful subject line and body. - [ ] Format the pull request title like `[SCB-XXX] Fixes bug in ApproximateQuantiles`, where you replace `SCB-XXX` with the appropriate JIRA issue. - [ ] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [ ] Run `go build` `go test` `go fmt` `go vet` to make sure basic checks pass. A more thorough check will be performed on your pull request automatically. - [ ] If this contribution is large, please file an Apache [Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf). --- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [servicecomb-java-chassis] GuoYL123 opened a new pull request #1909: [SCB-2057] set the AppId, ServiceName, Version information by reading…
GuoYL123 opened a new pull request #1909: URL: https://github.com/apache/servicecomb-java-chassis/pull/1909 … the environment variable (cherry picked from commit 9f6c57220fa48cd2f53324124ae0271b5ddae16f) Follow this checklist to help us incorporate your contribution quickly and easily: - [ ] Make sure there is a [JIRA issue](https://issues.apache.org/jira/browse/SCB) filed for the change (usually before you start working on it). Trivial changes like typos do not require a JIRA issue. Your pull request should address just this issue, without pulling in other changes. - [ ] Each commit in the pull request should have a meaningful subject line and body. - [ ] Format the pull request title like `[SCB-XXX] Fixes bug in ApproximateQuantiles`, where you replace `SCB-XXX` with the appropriate JIRA issue. - [ ] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [ ] Run `mvn clean install -Pit` to make sure basic checks pass. A more thorough check will be performed on your pull request automatically. - [ ] If this contribution is large, please file an Apache [Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf). --- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [servicecomb-java-chassis] liubao68 merged pull request #1906: [SCB-1754]accessor problem fix: CseHttpMessageConverter response access
liubao68 merged pull request #1906: URL: https://github.com/apache/servicecomb-java-chassis/pull/1906 This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[servicecomb-java-chassis] branch master updated: [SCB-1754]accessor problem fix: CseHttpMessageConverter response access
This is an automated email from the ASF dual-hosted git repository. liubao pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/servicecomb-java-chassis.git The following commit(s) were added to refs/heads/master by this push: new ad9516d [SCB-1754]accessor problem fix: CseHttpMessageConverter response access ad9516d is described below commit ad9516dfad410a4162a7180336306200f410c0c1 Author: liubao AuthorDate: Mon Aug 3 14:55:43 2020 +0800 [SCB-1754]accessor problem fix: CseHttpMessageConverter response access --- .../springmvc/reference/CseClientHttpResponse.java | 1 - .../reference}/CseHttpMessageConverter.java| 30 + .../CseHttpMessageConverterExtractor.java | 31 + .../CseResponseEntityResponseExtractor.java| 49 .../springmvc/reference/CseRestTemplate.java | 126 - .../reference/async/CseAsyncRestTemplate.java | 23 +++- .../web/client/TestCseHttpMessageConverter.java| 52 - 7 files changed, 231 insertions(+), 81 deletions(-) diff --git a/providers/provider-springmvc/src/main/java/org/apache/servicecomb/provider/springmvc/reference/CseClientHttpResponse.java b/providers/provider-springmvc/src/main/java/org/apache/servicecomb/provider/springmvc/reference/CseClientHttpResponse.java index 52092c9..a06160a 100644 --- a/providers/provider-springmvc/src/main/java/org/apache/servicecomb/provider/springmvc/reference/CseClientHttpResponse.java +++ b/providers/provider-springmvc/src/main/java/org/apache/servicecomb/provider/springmvc/reference/CseClientHttpResponse.java @@ -90,7 +90,6 @@ public class CseClientHttpResponse implements ClientHttpResponse { @Override public HttpStatus getStatusCode() throws IOException { -// TODO:springmvc不允许自定义http错误码 return HttpStatus.valueOf(response.getStatusCode()); } diff --git a/providers/provider-springmvc/src/main/java/org/springframework/web/client/CseHttpMessageConverter.java b/providers/provider-springmvc/src/main/java/org/apache/servicecomb/provider/springmvc/reference/CseHttpMessageConverter.java similarity index 75% rename from providers/provider-springmvc/src/main/java/org/springframework/web/client/CseHttpMessageConverter.java rename to providers/provider-springmvc/src/main/java/org/apache/servicecomb/provider/springmvc/reference/CseHttpMessageConverter.java index 5693f35..35c37b9 100644 --- a/providers/provider-springmvc/src/main/java/org/springframework/web/client/CseHttpMessageConverter.java +++ b/providers/provider-springmvc/src/main/java/org/apache/servicecomb/provider/springmvc/reference/CseHttpMessageConverter.java @@ -15,16 +15,13 @@ * limitations under the License. */ -package org.springframework.web.client; +package org.apache.servicecomb.provider.springmvc.reference; import java.io.IOException; -import java.lang.reflect.Field; import java.lang.reflect.Type; import java.util.Arrays; import java.util.List; -import org.apache.servicecomb.provider.springmvc.reference.CseClientHttpRequest; -import org.apache.servicecomb.provider.springmvc.reference.CseClientHttpResponse; import org.springframework.http.HttpInputMessage; import org.springframework.http.HttpOutputMessage; import org.springframework.http.MediaType; @@ -32,26 +29,14 @@ import org.springframework.http.converter.GenericHttpMessageConverter; import org.springframework.http.converter.HttpMessageNotReadableException; import org.springframework.http.converter.HttpMessageNotWritableException; import org.springframework.lang.Nullable; -import org.springframework.util.ReflectionUtils; -/** - * 需要访问MessageBodyClientHttpResponseWrapper - * 这是一个package级别的类,只好放在特殊的包内了 - */ public class CseHttpMessageConverter implements GenericHttpMessageConverter { private static final List ALL_MEDIA_TYPE = Arrays.asList(MediaType.ALL); - private static final Field RESPONSE_FIELD = - ReflectionUtils.findField(MessageBodyClientHttpResponseWrapper.class, "response"); - - static { -RESPONSE_FIELD.setAccessible(true); - } - @Override public boolean canRead(Class clazz, MediaType mediaType) { -return true; +return false; } @Override @@ -67,14 +52,11 @@ public class CseHttpMessageConverter implements GenericHttpMessageConverter clazz, HttpInputMessage inputMessage) throws IOException, HttpMessageNotReadableException { -return read(inputMessage); +throw new IllegalStateException("not supported"); } private Object read(HttpInputMessage inputMessage) { -MessageBodyClientHttpResponseWrapper respWrapper = (MessageBodyClientHttpResponseWrapper) inputMessage; -CseClientHttpResponse resp = -(CseClientHttpResponse) ReflectionUtils.getField(RESPONSE_FIELD, respWrapper); -return resp.getResult(); +throw new IllegalStateException("not supported"); } @Override @@ -90,13 +72,13 @@ public class CseHttpMessageConverter implements
[servicecomb-java-chassis] branch master updated: [SCB-1753]accessor problem fix: LinkedBlockingQueueEx queue features
This is an automated email from the ASF dual-hosted git repository. wujimin pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/servicecomb-java-chassis.git The following commit(s) were added to refs/heads/master by this push: new 509be4e [SCB-1753]accessor problem fix: LinkedBlockingQueueEx queue features 509be4e is described below commit 509be4ee98eedacef43fb8739ea6636e36478873 Author: liubao AuthorDate: Mon Aug 3 20:55:10 2020 +0800 [SCB-1753]accessor problem fix: LinkedBlockingQueueEx queue features --- .../servicecomb/core/executor/GroupExecutor.java | 2 +- .../core/executor/LinkedBlockingQueueEx.java | 63 ++ .../core/executor/ThreadPoolExecutorEx.java| 13 - .../core/executor/TestThreadPoolExecutorEx.java| 14 +++-- .../it/edge/handler/ExceptionConvertHandler.java | 2 - 5 files changed, 40 insertions(+), 54 deletions(-) diff --git a/core/src/main/java/org/apache/servicecomb/core/executor/GroupExecutor.java b/core/src/main/java/org/apache/servicecomb/core/executor/GroupExecutor.java index 41371b4..535b8a2 100644 --- a/core/src/main/java/org/apache/servicecomb/core/executor/GroupExecutor.java +++ b/core/src/main/java/org/apache/servicecomb/core/executor/GroupExecutor.java @@ -87,7 +87,7 @@ public class GroupExecutor implements Executor, Closeable { maxThreads, maxIdleInSecond, TimeUnit.SECONDS, - new LinkedBlockingQueueEx<>(maxQueueSize), + new LinkedBlockingQueueEx(maxQueueSize), factory); executorList.add(executor); } diff --git a/core/src/main/java/org/apache/servicecomb/core/executor/LinkedBlockingQueueEx.java b/core/src/main/java/org/apache/servicecomb/core/executor/LinkedBlockingQueueEx.java index 57b8450..aba525f 100644 --- a/core/src/main/java/org/apache/servicecomb/core/executor/LinkedBlockingQueueEx.java +++ b/core/src/main/java/org/apache/servicecomb/core/executor/LinkedBlockingQueueEx.java @@ -16,81 +16,50 @@ */ package org.apache.servicecomb.core.executor; -import java.lang.reflect.Field; -import java.lang.reflect.Method; import java.util.concurrent.LinkedBlockingQueue; -import java.util.concurrent.ThreadPoolExecutor; -import java.util.concurrent.atomic.AtomicInteger; +import java.util.concurrent.RejectedExecutionException; -public class LinkedBlockingQueueEx extends LinkedBlockingQueue { +public class LinkedBlockingQueueEx extends LinkedBlockingQueue { private static final long serialVersionUID = -1L; - private static final int COUNT_BITS = Integer.SIZE - 3; - - private static final int CAPACITY = (1 << COUNT_BITS) - 1; - - private static int workerCountOf(int c) { -return c & CAPACITY; - } - - private static Method addWrokerMethod; - private transient volatile ThreadPoolExecutorEx owner = null; - private AtomicInteger ctl; - public LinkedBlockingQueueEx(int capacity) { super(capacity); } public void setOwner(ThreadPoolExecutorEx owner) { this.owner = owner; -try { - addWrokerMethod = ThreadPoolExecutor.class.getDeclaredMethod("addWorker", Runnable.class, boolean.class); - addWrokerMethod.setAccessible(true); - - Field field = ThreadPoolExecutor.class.getDeclaredField("ctl"); - field.setAccessible(true); - ctl = (AtomicInteger) field.get(owner); -} catch (Throwable e) { - throw new IllegalStateException("failed to init queue.", e); -} } @Override - public boolean offer(E runnable) { + public boolean offer(Runnable runnable) { // task can come before owner available if (owner == null) { return super.offer(runnable); } - // can not create more thread, just queue the task -if (workerCountOf(ctl.get()) == owner.getMaximumPoolSize()) { +if (owner.getPoolSize() == owner.getMaximumPoolSize()) { return super.offer(runnable); } // no need to create more thread, just queue the task -if (owner.getNotFinished() <= workerCountOf(ctl.get())) { +if (owner.getNotFinished() <= owner.getPoolSize()) { return super.offer(runnable); } // all threads are busy, and can create new thread, not queue the task -if (workerCountOf(ctl.get()) < owner.getMaximumPoolSize()) { - try { -// low frequency event, reflect is no problem -if (!(Boolean) addWrokerMethod.invoke(owner, runnable, false)) { - // failed to create new thread, queue the task - // if failed to queue the task, owner will try to addWorker again, - // if still failed, the will reject the task - return super.offer(runnable); -} - -// create new thread successfully, treat it as queue success -return true; - } catch (Throwable e) { -// reflection exception, should never happened -return super.offer(runnable); - } +if (owner.getPoolSize() < owner.getMaximumPoolSize()) { + return false;
[GitHub] [servicecomb-java-chassis] wujimin merged pull request #1908: [SCB-1753]accessor problem fix: LinkedBlockingQueueEx queue features
wujimin merged pull request #1908: URL: https://github.com/apache/servicecomb-java-chassis/pull/1908 This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org