You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by GitBox <gi...@apache.org> on 2022/12/09 12:01:30 UTC
[GitHub] [dubbo] suncairong163 opened a new pull request, #11108: 3.2 consumer proxy invocation handler
suncairong163 opened a new pull request, #11108:
URL: https://github.com/apache/dubbo/pull/11108
## What is the purpose of the change
consumer proxy invocation handler
## Brief changelog
##Related issues
#10803
@AlbumenJ
## Verifying this change
<!-- Follow this checklist to help us incorporate your contribution quickly and easily: -->
## Checklist
- [x] Make sure there is a [GitHub_issue](https://github.com/apache/dubbo/issues) field for the change (usually before you start working on it). Trivial changes like typos do not require a GitHub issue. Your pull request should address just this issue, without pulling in other changes - one PR resolves one issue.
- [ ] Each commit in the pull request should have a meaningful subject line and body.
- [ ] Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
- [ ] Check if is necessary to patch to Dubbo 3 if you are work on Dubbo 2.7
- [ ] Write necessary unit-test to verify your logic correction, more mock a little better when cross module dependency exist. If the new feature or significant change is committed, please remember to add sample in [dubbo samples](https://github.com/apache/dubbo-samples) project.
- [ ] Add some description to [dubbo-website](https://github.com/apache/dubbo-website) project if you are requesting to add a feature.
- [ ] GitHub Actions works fine on your own branch.
- [ ] If this contribution is large, please follow the [Software Donation Guide](https://github.com/apache/dubbo/wiki/Software-donation-guide).
--
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.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
[GitHub] [dubbo] AlbumenJ merged pull request #11108: 3.2 consumer proxy invocation handler
Posted by "AlbumenJ (via GitHub)" <gi...@apache.org>.
AlbumenJ merged PR #11108:
URL: https://github.com/apache/dubbo/pull/11108
--
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.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
[GitHub] [dubbo] codecov-commenter commented on pull request #11108: 3.2 consumer proxy invocation handler
Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #11108:
URL: https://github.com/apache/dubbo/pull/11108#issuecomment-1439459636
# [Codecov](https://codecov.io/gh/apache/dubbo/pull/11108?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
> Merging [#11108](https://codecov.io/gh/apache/dubbo/pull/11108?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (c20e9d9) into [3.2](https://codecov.io/gh/apache/dubbo/commit/10e7162268597fbee8e9e42db996969f10346cfa?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (10e7162) will **decrease** coverage by `0.53%`.
> The diff coverage is `n/a`.
```diff
@@ Coverage Diff @@
## 3.2 #11108 +/- ##
============================================
- Coverage 69.73% 69.20% -0.53%
+ Complexity 339 2 -337
============================================
Files 1573 1444 -129
Lines 84263 61107 -23156
Branches 15298 9044 -6254
============================================
- Hits 58758 42290 -16468
+ Misses 20584 14654 -5930
+ Partials 4921 4163 -758
```
| [Impacted Files](https://codecov.io/gh/apache/dubbo/pull/11108?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
|---|---|---|
| [...g/apache/dubbo/common/json/impl/FastJson2Impl.java](https://codecov.io/gh/apache/dubbo/pull/11108?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZHViYm8tY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9kdWJiby9jb21tb24vanNvbi9pbXBsL0Zhc3RKc29uMkltcGwuamF2YQ==) | | |
| [...rg/apache/dubbo/common/json/impl/FastJsonImpl.java](https://codecov.io/gh/apache/dubbo/pull/11108?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZHViYm8tY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9kdWJiby9jb21tb24vanNvbi9pbXBsL0Zhc3RKc29uSW1wbC5qYXZh) | | |
| [...org/apache/dubbo/common/json/impl/JacksonImpl.java](https://codecov.io/gh/apache/dubbo/pull/11108?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZHViYm8tY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9kdWJiby9jb21tb24vanNvbi9pbXBsL0phY2tzb25JbXBsLmphdmE=) | | |
| [...che/dubbo/metadata/AbstractServiceNameMapping.java](https://codecov.io/gh/apache/dubbo/pull/11108?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZHViYm8tbWV0YWRhdGEvZHViYm8tbWV0YWRhdGEtYXBpL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9kdWJiby9tZXRhZGF0YS9BYnN0cmFjdFNlcnZpY2VOYW1lTWFwcGluZy5qYXZh) | | |
| [...est/AbstractAnnotatedMethodParameterProcessor.java](https://codecov.io/gh/apache/dubbo/pull/11108?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZHViYm8tbWV0YWRhdGEvZHViYm8tbWV0YWRhdGEtYXBpL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9kdWJiby9tZXRhZGF0YS9yZXN0L0Fic3RyYWN0QW5ub3RhdGVkTWV0aG9kUGFyYW1ldGVyUHJvY2Vzc29yLmphdmE=) | | |
| [...data/rest/AbstractServiceRestMetadataResolver.java](https://codecov.io/gh/apache/dubbo/pull/11108?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZHViYm8tbWV0YWRhdGEvZHViYm8tbWV0YWRhdGEtYXBpL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9kdWJiby9tZXRhZGF0YS9yZXN0L0Fic3RyYWN0U2VydmljZVJlc3RNZXRhZGF0YVJlc29sdmVyLmphdmE=) | | |
| [...tadata/rest/AnnotatedMethodParameterProcessor.java](https://codecov.io/gh/apache/dubbo/pull/11108?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZHViYm8tbWV0YWRhdGEvZHViYm8tbWV0YWRhdGEtYXBpL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9kdWJiby9tZXRhZGF0YS9yZXN0L0Fubm90YXRlZE1ldGhvZFBhcmFtZXRlclByb2Nlc3Nvci5qYXZh) | | |
| [...rg/apache/dubbo/metadata/rest/RequestMetadata.java](https://codecov.io/gh/apache/dubbo/pull/11108?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZHViYm8tbWV0YWRhdGEvZHViYm8tbWV0YWRhdGEtYXBpL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9kdWJiby9tZXRhZGF0YS9yZXN0L1JlcXVlc3RNZXRhZGF0YS5qYXZh) | | |
| [...che/dubbo/metadata/rest/RestMetadataConstants.java](https://codecov.io/gh/apache/dubbo/pull/11108?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZHViYm8tbWV0YWRhdGEvZHViYm8tbWV0YWRhdGEtYXBpL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9kdWJiby9tZXRhZGF0YS9yZXN0L1Jlc3RNZXRhZGF0YUNvbnN0YW50cy5qYXZh) | | |
| [...apache/dubbo/metadata/rest/RestMethodMetadata.java](https://codecov.io/gh/apache/dubbo/pull/11108?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZHViYm8tbWV0YWRhdGEvZHViYm8tbWV0YWRhdGEtYXBpL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9kdWJiby9tZXRhZGF0YS9yZXN0L1Jlc3RNZXRob2RNZXRhZGF0YS5qYXZh) | | |
| ... and [3006 more](https://codecov.io/gh/apache/dubbo/pull/11108?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
:mega: We’re building smart automated test selection to slash your CI/CD build times. [Learn more](https://about.codecov.io/iterative-testing/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
--
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.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
[GitHub] [dubbo] sonarcloud[bot] commented on pull request #11108: 3.2 consumer proxy invocation handler
Posted by "sonarcloud[bot] (via GitHub)" <gi...@apache.org>.
sonarcloud[bot] commented on PR #11108:
URL: https://github.com/apache/dubbo/pull/11108#issuecomment-1439456128
SonarCloud Quality Gate failed. [![Quality Gate failed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/failed-16px.png 'Quality Gate failed')](https://sonarcloud.io/dashboard?id=apache_dubbo&pullRequest=11108)
[![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache_dubbo&pullRequest=11108&resolved=false&types=BUG) [![C](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/C-16px.png 'C')](https://sonarcloud.io/project/issues?id=apache_dubbo&pullRequest=11108&resolved=false&types=BUG) [2 Bugs](https://sonarcloud.io/project/issues?id=apache_dubbo&pullRequest=11108&resolved=false&types=BUG)
[![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png 'Vulnerability')](https://sonarcloud.io/project/issues?id=apache_dubbo&pullRequest=11108&resolved=false&types=VULNERABILITY) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_dubbo&pullRequest=11108&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_dubbo&pullRequest=11108&resolved=false&types=VULNERABILITY)
[![Security Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png 'Security Hotspot')](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo&pullRequest=11108&resolved=false&types=SECURITY_HOTSPOT) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo&pullRequest=11108&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo&pullRequest=11108&resolved=false&types=SECURITY_HOTSPOT)
[![Code Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png 'Code Smell')](https://sonarcloud.io/project/issues?id=apache_dubbo&pullRequest=11108&resolved=false&types=CODE_SMELL) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_dubbo&pullRequest=11108&resolved=false&types=CODE_SMELL) [225 Code Smells](https://sonarcloud.io/project/issues?id=apache_dubbo&pullRequest=11108&resolved=false&types=CODE_SMELL)
[![43.4%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/40-16px.png '43.4%')](https://sonarcloud.io/component_measures?id=apache_dubbo&pullRequest=11108&metric=new_coverage&view=list) [43.4% Coverage](https://sonarcloud.io/component_measures?id=apache_dubbo&pullRequest=11108&metric=new_coverage&view=list)
[![0.9%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3-16px.png '0.9%')](https://sonarcloud.io/component_measures?id=apache_dubbo&pullRequest=11108&metric=new_duplicated_lines_density&view=list) [0.9% Duplication](https://sonarcloud.io/component_measures?id=apache_dubbo&pullRequest=11108&metric=new_duplicated_lines_density&view=list)
--
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.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
[GitHub] [dubbo] EarthChen commented on a diff in pull request #11108: 3.2 consumer proxy invocation handler
Posted by "EarthChen (via GitHub)" <gi...@apache.org>.
EarthChen commented on code in PR #11108:
URL: https://github.com/apache/dubbo/pull/11108#discussion_r1103618654
##########
dubbo-metadata/dubbo-metadata-api/src/main/java/org/apache/dubbo/metadata/rest/NoAnnotatedParameterRequestTagProcessor.java:
##########
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.dubbo.metadata.rest;
+
+import org.apache.dubbo.common.extension.SPI;
+import org.apache.dubbo.metadata.rest.media.MediaType;
+
+import java.lang.reflect.Parameter;
+
+@SPI
Review Comment:
set scope
##########
dubbo-metadata/dubbo-metadata-api/pom.xml:
##########
@@ -45,13 +45,13 @@
<version>${project.parent.version}</version>
</dependency>
- <!-- Test dependencies -->
- <dependency>
- <groupId>org.apache.dubbo</groupId>
- <artifactId>dubbo-configcenter-zookeeper</artifactId>
- <version>${project.parent.version}</version>
- <scope>test</scope>
- </dependency>
+<!-- <!– Test dependencies –>-->
Review Comment:
remove this
##########
dubbo-rpc/dubbo-rpc-rest/src/main/java/org/apache/dubbo/rpc/protocol/rest/message/HttpMessageEncode.java:
##########
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.dubbo.rpc.protocol.rest.message;
+
+
+import org.apache.dubbo.common.URL;
+
+import java.io.ByteArrayOutputStream;
+
+
+public interface HttpMessageEncode {
+
+ void encode(ByteArrayOutputStream outputStream, Object unSerializedBody, URL url) throws Exception;
Review Comment:
replace outputstream
##########
dubbo-rpc/dubbo-rpc-rest/src/main/java/org/apache/dubbo/rpc/protocol/rest/message/HttpMessageDecode.java:
##########
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.dubbo.rpc.protocol.rest.message;
+
+
+public interface HttpMessageDecode{
+
+ Object decode(byte[] body, Class targetType) throws Exception;
Review Comment:
Use generic replacement
--
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.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
[GitHub] [dubbo] AlbumenJ commented on a diff in pull request #11108: 3.2 consumer proxy invocation handler
Posted by GitBox <gi...@apache.org>.
AlbumenJ commented on code in PR #11108:
URL: https://github.com/apache/dubbo/pull/11108#discussion_r1065670168
##########
dubbo-remoting/dubbo-remoting-http/pom.xml:
##########
@@ -59,5 +59,13 @@
<version>4.5.5</version>
<scope>test</scope>
</dependency>
+
+ <!-- https://mvnrepository.com/artifact/com.squareup.okhttp3/okhttp -->
+ <dependency>
+ <groupId>com.squareup.okhttp3</groupId>
+ <artifactId>okhttp</artifactId>
+ <scope>provided</scope>
+ </dependency>
Review Comment:
Add dependency version to `dubbo-dependencies-bom`
##########
dubbo-demo/dubbo-demo-interface/src/main/java/org/apache/dubbo/demo/RestDemoService.java:
##########
@@ -16,6 +16,8 @@
*/
package org.apache.dubbo.demo;
+import org.jboss.resteasy.annotations.Body;
Review Comment:
remove unused import
##########
dubbo-remoting/dubbo-remoting-http/pom.xml:
##########
@@ -59,5 +59,13 @@
<version>4.5.5</version>
<scope>test</scope>
</dependency>
+
+ <!-- https://mvnrepository.com/artifact/com.squareup.okhttp3/okhttp -->
Review Comment:
remove this tag
##########
dubbo-rpc/dubbo-rpc-rest/src/main/java/org/apache/dubbo/rpc/protocol/rest/factory/RestClientFactory.java:
##########
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.dubbo.rpc.protocol.rest.factory;
+
+import org.apache.dubbo.common.URL;
+import org.apache.dubbo.common.extension.Adaptive;
+import org.apache.dubbo.common.extension.ExtensionScope;
+import org.apache.dubbo.common.extension.SPI;
+import org.apache.dubbo.remoting.Constants;
+import org.apache.dubbo.remoting.http.RestClient;
+import org.apache.dubbo.rpc.RpcException;
+
+/**
+ * RestClientFactory. (API/SPI, Singleton, ThreadSafe)
+ */
+@SPI(value = "okhttp", scope = ExtensionScope.FRAMEWORK)
+public interface RestClientFactory {
Review Comment:
should be moved to `dubbo-remoting-rest`
##########
dubbo-rpc/dubbo-rpc-rest/src/main/java/org/apache/dubbo/rpc/protocol/rest/request/convert/RequestConvert.java:
##########
@@ -0,0 +1,24 @@
+package org.apache.dubbo.rpc.protocol.rest.request.convert;
+
+import org.apache.dubbo.common.URL;
+import org.apache.dubbo.common.extension.Adaptive;
+import org.apache.dubbo.common.extension.SPI;
+import org.apache.dubbo.metadata.rest.RestMethodMetadata;
+import org.apache.dubbo.remoting.RemotingException;
+import org.apache.dubbo.rpc.protocol.rest.annotation.consumer.RequestTemplate;
+import org.apache.dubbo.rpc.protocol.rest.request.client.ClientFacade;
+
+@SPI
+public interface RequestConvert<REQ, RES, CLIENT> extends ClientFacade<REQ, RES> {
Review Comment:
should be moved to `dubbo-remoting-rest`
##########
dubbo-rpc/dubbo-rpc-rest/src/main/java/org/apache/dubbo/rpc/protocol/rest/RestProtocol.java:
##########
@@ -72,17 +57,14 @@ public class RestProtocol extends AbstractProxyProtocol {
private final RestServerFactory serverFactory = new RestServerFactory();
- private final Map<String, ReferenceCountedClient> clients = new ConcurrentHashMap<>();
+ private final Map<String, ReferenceCountedClient<? extends RestClient>> clients = new ConcurrentHashMap<>();
- private volatile ConnectionMonitor connectionMonitor;
+ private final RestClientFactory clientFactory = FrameworkModel.defaultModel().getExtensionLoader(RestClientFactory.class).getAdaptiveExtension();
public RestProtocol() {
Review Comment:
```suggestion
public RestProtocol(FrameworkModel frameworkModel) {
```
##########
dubbo-rpc/dubbo-rpc-rest/src/main/java/org/apache/dubbo/rpc/protocol/rest/request/convert/RequestConvert.java:
##########
@@ -0,0 +1,24 @@
+package org.apache.dubbo.rpc.protocol.rest.request.convert;
+
+import org.apache.dubbo.common.URL;
+import org.apache.dubbo.common.extension.Adaptive;
+import org.apache.dubbo.common.extension.SPI;
+import org.apache.dubbo.metadata.rest.RestMethodMetadata;
+import org.apache.dubbo.remoting.RemotingException;
+import org.apache.dubbo.rpc.protocol.rest.annotation.consumer.RequestTemplate;
+import org.apache.dubbo.rpc.protocol.rest.request.client.ClientFacade;
+
+@SPI
+public interface RequestConvert<REQ, RES, CLIENT> extends ClientFacade<REQ, RES> {
+
+ @Adaptive
+ RequestConvert createRequestConvert(URL url, CLIENT restClient, RestMethodMetadata restMethodMetadata);
Review Comment:
exact to a factory class
##########
dubbo-rpc/dubbo-rpc-rest/src/main/java/org/apache/dubbo/rpc/protocol/rest/factory/AbstractHttpClientFactory.java:
##########
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.dubbo.rpc.protocol.rest.factory;
+
+import org.apache.dubbo.common.URL;
+import org.apache.dubbo.common.logger.ErrorTypeAwareLogger;
+import org.apache.dubbo.common.logger.LoggerFactory;
+import org.apache.dubbo.remoting.http.RestClient;
+import org.apache.dubbo.remoting.http.config.HttpClientConfig;
+import org.apache.dubbo.rpc.RpcException;
+
+/**
+ * AbstractHttpClientFactory
+ */
+public abstract class AbstractHttpClientFactory implements RestClientFactory {
Review Comment:
should be moved to `dubbo-remoting-rest`
##########
dubbo-rpc/dubbo-rpc-rest/src/main/java/org/apache/dubbo/rpc/protocol/rest/factory/impl/ApacheHttpClientFactory.java:
##########
@@ -0,0 +1,23 @@
+package org.apache.dubbo.rpc.protocol.rest.factory.impl;
+
+import org.apache.dubbo.common.URL;
+import org.apache.dubbo.common.extension.Activate;
+import org.apache.dubbo.remoting.http.RestClient;
+import org.apache.dubbo.rpc.RpcException;
+import org.apache.dubbo.rpc.protocol.rest.factory.AbstractHttpClientFactory;
+
+@Activate(value = "apacheHttpclient")
+public class ApacheHttpClientFactory extends AbstractHttpClientFactory {
Review Comment:
should be moved to `dubbo-remoting-rest`
##########
dubbo-rpc/dubbo-rpc-rest/src/main/java/org/apache/dubbo/rpc/protocol/rest/factory/impl/OkHttpClientFactory.java:
##########
@@ -0,0 +1,19 @@
+package org.apache.dubbo.rpc.protocol.rest.factory.impl;
+
+import org.apache.dubbo.common.URL;
+import org.apache.dubbo.common.extension.Activate;
+import org.apache.dubbo.remoting.http.RestClient;
+import org.apache.dubbo.remoting.http.okhttp.OKHttpRestClient;
+import org.apache.dubbo.rpc.RpcException;
+import org.apache.dubbo.rpc.protocol.rest.factory.AbstractHttpClientFactory;
+
+@Activate("okhttp")
+public class OkHttpClientFactory extends AbstractHttpClientFactory {
Review Comment:
should be moved to `dubbo-remoting-rest`
##########
dubbo-rpc/dubbo-rpc-rest/src/main/java/org/apache/dubbo/rpc/protocol/rest/request/convert/OkHttpRequestConvert.java:
##########
@@ -0,0 +1,69 @@
+package org.apache.dubbo.rpc.protocol.rest.request.convert;
+
+import okhttp3.*;
+import org.apache.dubbo.common.URL;
+import org.apache.dubbo.common.extension.Adaptive;
+import org.apache.dubbo.metadata.rest.RestMethodMetadata;
+import org.apache.dubbo.metadata.rest.media.MediaType;
+import org.apache.dubbo.remoting.http.okhttp.OKHttpRestClient;
+import org.apache.dubbo.rpc.protocol.rest.annotation.consumer.RequestTemplate;
+import org.apache.dubbo.rpc.protocol.rest.constans.RestConstant;
+import org.apache.dubbo.rpc.protocol.rest.message.HttpMessageCodec;
+import org.apache.dubbo.rpc.protocol.rest.request.BaseConvert;
+
+import java.util.Collection;
+import java.util.Map;
+
+@Adaptive("okhttp")
+public class OkHttpRequestConvert extends BaseConvert<Request, Response, OKHttpRestClient> {
Review Comment:
should be moved to `dubbo-remoting-rest`
--
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.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
[GitHub] [dubbo] AlbumenJ commented on a diff in pull request #11108: 3.2 consumer proxy invocation handler
Posted by GitBox <gi...@apache.org>.
AlbumenJ commented on code in PR #11108:
URL: https://github.com/apache/dubbo/pull/11108#discussion_r1065516102
##########
dubbo-metadata/dubbo-metadata-annotation-rest/src/main/java/org/apache/dubbo/metadata/annotation/rest/ApplicationPath.java:
##########
@@ -0,0 +1,77 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright (c) 2010-2015 Oracle and/or its affiliates. All rights reserved.
+ *
+ * The contents of this file are subject to the terms of either the GNU
+ * General Public License Version 2 only ("GPL") or the Common Development
+ * and Distribution License("CDDL") (collectively, the "License"). You
+ * may not use this file except in compliance with the License. You can
+ * obtain a copy of the License at
+ * http://glassfish.java.net/public/CDDL+GPL_1_1.html
+ * or packager/legal/LICENSE.txt. See the License for the specific
+ * language governing permissions and limitations under the License.
+ *
+ * When distributing the software, include this License Header Notice in each
+ * file and include the License file at packager/legal/LICENSE.txt.
+ *
+ * GPL Classpath Exception:
+ * Oracle designates this particular file as subject to the "Classpath"
+ * exception as provided by Oracle in the GPL Version 2 section of the License
+ * file that accompanied this code.
+ *
+ * Modifications:
+ * If applicable, add the following below the License Header, with the fields
+ * enclosed by brackets [] replaced by your own identifying information:
+ * "Portions Copyright [year] [name of copyright owner]"
+ *
+ * Contributor(s):
+ * If you wish your version of this file to be governed by only the CDDL or
+ * only the GPL Version 2, indicate your decision by adding "[Contributor]
+ * elects to include this software in this distribution under the [CDDL or GPL
+ * Version 2] license." If you don't indicate a single choice of license, a
+ * recipient has the option to distribute your version of this file under
+ * either the CDDL, the GPL Version 2 or to extend the choice of license to
+ * its licensees as provided above. However, if you add GPL Version 2 code
+ * and therefore, elected the GPL Version 2 license, then the option applies
+ * only if the new code is made subject to such option by the copyright
+ * holder.
+ */
+
+package org.apache.dubbo.metadata.annotation.rest;
+
+import javax.ws.rs.Path;
+import java.lang.annotation.*;
+
+/**
+ * Identifies the application path that serves as the base URI
+ * for all resource URIs provided by {@link javax.ws.rs.Path}. May only be
+ * applied to a subclass of {@link javax.ws.rs.core.Application}.
+ *
+ * <p>When published in a Servlet container, the value of the application path
+ * may be overridden using a servlet-mapping element in the web.xml.</p>
+ *
+ * @author Paul Sandoz
+ * @author Marc Hadley
+ * @see javax.ws.rs.core.Application
+ * @see Path
+ * @since 1.1
+ */
+@Documented
+@Target({ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+public @interface ApplicationPath {
+
+ /**
+ * Defines the base URI for all resource URIs. A trailing '/' character will
+ * be automatically appended if one is not present.
+ *
+ * <p>The supplied value is automatically percent
+ * encoded to conform to the {@code path} production of
+ * {@link <a href="http://tools.ietf.org/html/rfc3986#section-3.3">RFC 3986 section 3.3</a>}.
+ * Note that percent encoded values are allowed in the value, an
+ * implementation will recognize such values and will not double
+ * encode the '%' character.</p>
+ */
+ String value();
+}
Review Comment:
Use jar dependency instead
##########
dubbo-common/src/test/java/org/apache/dubbo/common/vo/UserVo.java:
##########
@@ -0,0 +1,68 @@
+package org.apache.dubbo.common.vo;
Review Comment:
Add ASF license header for all newly created files
--
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.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
[GitHub] [dubbo] icodening commented on a diff in pull request #11108: 3.2 consumer proxy invocation handler
Posted by "icodening (via GitHub)" <gi...@apache.org>.
icodening commented on code in PR #11108:
URL: https://github.com/apache/dubbo/pull/11108#discussion_r1100184152
##########
dubbo-common/src/main/java/org/apache/dubbo/common/json/impl/FastJson2Impl.java:
##########
@@ -49,5 +59,35 @@ public <T> List<T> toJavaList(String json, Class<T> clazz) {
public String toJson(Object obj) {
return com.alibaba.fastjson2.JSON.toJSONString(obj, JSONWriter.Feature.WriteEnumsUsingName);
}
+
+ @Override
+ public <T> T parseObject(byte[] bytes, Class<T> clazz) {
+ return com.alibaba.fastjson2.JSON.parseObject(bytes, clazz);
+ }
+
+ @Override
+ public <T> T parseObject(InputStream inputStream, Class<T> clazz) {
+ return com.alibaba.fastjson2.JSON.parseObject(inputStream, fastJsonConfig.getCharset(), clazz);
+
+ }
+
+ @Override
+ public <T> void serializeObject(OutputStream outputStream, Object value) throws Exception {
+ ByteArrayOutputStream outnew = new ByteArrayOutputStream();
+ SerializeFilter[] globalFilters = this.fastJsonConfig.getSerializeFilters();
+ List<SerializeFilter> allFilters = new ArrayList(Arrays.asList(globalFilters));
+
+
+ if (value instanceof FastJsonContainer) {
+ FastJsonContainer fastJsonContainer = (FastJsonContainer) value;
+ PropertyPreFilters filters = fastJsonContainer.getFilters();
+ allFilters.addAll(filters.getFilters());
+ value = fastJsonContainer.getValue();
+ }
+ com.alibaba.fastjson2.JSON.writeTo(outnew, value);
Review Comment:
Why not use `outputStream` directly here
##########
dubbo-common/src/main/java/org/apache/dubbo/common/json/impl/GsonImpl.java:
##########
@@ -21,7 +21,9 @@
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
+import java.io.*;
Review Comment:
don't use `import java.io.*`
##########
dubbo-common/src/main/java/org/apache/dubbo/common/json/impl/FastJsonImpl.java:
##########
@@ -49,4 +60,38 @@ public <T> List<T> toJavaList(String json, Class<T> clazz) {
public String toJson(Object obj) {
return com.alibaba.fastjson.JSON.toJSONString(obj, SerializerFeature.DisableCircularReferenceDetect);
}
+
+ @Override
+ public <T> T parseObject(byte[] bytes, Class<T> clazz) {
+ return com.alibaba.fastjson.JSON.parseObject(bytes, clazz);
+ }
+
+ @Override
+ public <T> T parseObject(InputStream inputStream, Class<T> clazz) throws Exception {
+ return com.alibaba.fastjson.JSON.parseObject(inputStream, fastJsonConfig.getCharset(), clazz);
+ }
+
+ @Override
+ public <T> void serializeObject(OutputStream outputStream, Object value) throws Exception {
+
+ ByteArrayOutputStream outnew = new ByteArrayOutputStream();
+ SerializeFilter[] globalFilters = this.fastJsonConfig.getSerializeFilters();
+ List<SerializeFilter> allFilters = new ArrayList(Arrays.asList(globalFilters));
+
+
+ if (value instanceof FastJsonContainer) {
+ FastJsonContainer fastJsonContainer = (FastJsonContainer) value;
+ PropertyPreFilters filters = fastJsonContainer.getFilters();
+ allFilters.addAll(filters.getFilters());
+ value = fastJsonContainer.getValue();
+ }
+ JSON.writeJSONStringWithFastJsonConfig(outnew, this.fastJsonConfig.getCharset(), value,
Review Comment:
same as above. `FastJson2Impl:87`
##########
dubbo-common/src/test/java/org/apache/dubbo/common/utils/JsonUtilsTest.java:
##########
@@ -278,4 +282,40 @@ public Class<?> loadClass(String name) throws ClassNotFoundException {
Thread.currentThread().setContextClassLoader(originClassLoader);
JsonUtils.setJson(null);
}
+
+ @Test
+ public void TestStream() throws Exception {
+ UserVo instance = UserVo.getInstance();
+ byte[] bytes = new byte[4];
+ for (int i = 0; i < bytes.length; i++) {
+ bytes[i] = (byte) i;
+ }
+
+ List<Object> objects = Arrays.asList(instance, 1, "dubbo", bytes);
+
+ List<JSON> jsons = Arrays.asList(new GsonImpl(), new JacksonImpl(), new FastJson2Impl(), new FastJsonImpl());
+
+ for (int i = 0; i < objects.size(); i++) {
+
+ for (JSON json : jsons) {
+
+ ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
+ Object value = objects.get(i);
+ json.serializeObject(byteArrayOutputStream, value);
+
+ ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(byteArrayOutputStream.toByteArray());
+ Object object1 = json.parseObject(byteArrayInputStream, value.getClass());
+
+ if (value.getClass().isArray()) {
+ Arrays.equals((byte[]) value, (byte[]) object1);
Review Comment:
use assert
##########
dubbo-common/src/test/java/org/apache/dubbo/common/utils/JsonUtilsTest.java:
##########
@@ -278,4 +282,40 @@ public Class<?> loadClass(String name) throws ClassNotFoundException {
Thread.currentThread().setContextClassLoader(originClassLoader);
JsonUtils.setJson(null);
}
+
+ @Test
+ public void TestStream() throws Exception {
+ UserVo instance = UserVo.getInstance();
+ byte[] bytes = new byte[4];
+ for (int i = 0; i < bytes.length; i++) {
+ bytes[i] = (byte) i;
+ }
+
+ List<Object> objects = Arrays.asList(instance, 1, "dubbo", bytes);
+
+ List<JSON> jsons = Arrays.asList(new GsonImpl(), new JacksonImpl(), new FastJson2Impl(), new FastJsonImpl());
+
+ for (int i = 0; i < objects.size(); i++) {
+
+ for (JSON json : jsons) {
+
+ ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
+ Object value = objects.get(i);
+ json.serializeObject(byteArrayOutputStream, value);
+
+ ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(byteArrayOutputStream.toByteArray());
+ Object object1 = json.parseObject(byteArrayInputStream, value.getClass());
+
+ if (value.getClass().isArray()) {
+ Arrays.equals((byte[]) value, (byte[]) object1);
+ } else {
+ Assertions.assertEquals(object1, value);
Review Comment:
plz exchange param position
##########
dubbo-metadata/dubbo-metadata-api/src/main/java/org/apache/dubbo/metadata/rest/AbstractServiceRestMetadataResolver.java:
##########
@@ -36,6 +28,14 @@
import java.util.Set;
import java.util.function.Consumer;
+import org.apache.dubbo.common.utils.MethodComparator;
Review Comment:
unnecessary changes
##########
dubbo-demo/dubbo-demo-interface/src/main/java/org/apache/dubbo/demo/RestDemoService.java:
##########
@@ -16,18 +16,20 @@
*/
package org.apache.dubbo.demo;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.QueryParam;
+
+import po.TestPO;
+
+import javax.ws.rs.*;
Review Comment:
don't use import *
##########
dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/rest/SpringRestService.java:
##########
@@ -19,13 +19,7 @@
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.http.MediaType;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestHeader;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
Review Comment:
don't use import *
--
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.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org