diff --git a/.artifacts b/.artifacts
index cd6334693d0..69d057be080 100644
--- a/.artifacts
+++ b/.artifacts
@@ -47,7 +47,6 @@ dubbo-kubernetes
dubbo-maven-plugin
dubbo-metadata
dubbo-metadata-api
-dubbo-metadata-rest
dubbo-metadata-definition-protobuf
dubbo-metadata-processor
dubbo-metadata-report-nacos
@@ -76,7 +75,6 @@ dubbo-registry-nacos
dubbo-registry-zookeeper
dubbo-remoting
dubbo-remoting-api
-dubbo-remoting-http
dubbo-remoting-http12
dubbo-remoting-netty
dubbo-remoting-netty4
@@ -87,7 +85,6 @@ dubbo-rpc
dubbo-rpc-api
dubbo-rpc-dubbo
dubbo-rpc-injvm
-dubbo-rpc-rest
dubbo-rpc-triple
dubbo-security
dubbo-serialization
diff --git a/dubbo-compatible/pom.xml b/dubbo-compatible/pom.xml
index 656bfed56f0..f6948de37a0 100644
--- a/dubbo-compatible/pom.xml
+++ b/dubbo-compatible/pom.xml
@@ -48,11 +48,6 @@
dubbo-remoting-zookeeper${project.parent.version}
-
- org.apache.dubbo
- dubbo-rpc-rest
- ${project.parent.version}
- org.apache.dubbodubbo-filter-cache
@@ -63,6 +58,17 @@
dubbo-filter-validation${project.parent.version}
+
+ javax.servlet
+ javax.servlet-api
+ provided
+
+
+
+ javax.ws.rs
+ javax.ws.rs-api
+ provided
+ log4jlog4j
diff --git a/dubbo-compatible/src/main/java/com/alibaba/dubbo/common/Constants.java b/dubbo-compatible/src/main/java/com/alibaba/dubbo/common/Constants.java
index 9579e26d67f..724b9f5da46 100644
--- a/dubbo-compatible/src/main/java/com/alibaba/dubbo/common/Constants.java
+++ b/dubbo-compatible/src/main/java/com/alibaba/dubbo/common/Constants.java
@@ -41,7 +41,6 @@ public class Constants
org.apache.dubbo.common.serialize.Constants,
org.apache.dubbo.common.config.configcenter.Constants,
org.apache.dubbo.metadata.report.support.Constants,
- org.apache.dubbo.rpc.protocol.rest.Constants,
org.apache.dubbo.registry.Constants {
public static final String PROVIDER = "provider";
diff --git a/dubbo-compatible/src/main/java/com/alibaba/dubbo/remoting/http/HttpBinder.java b/dubbo-compatible/src/main/java/com/alibaba/dubbo/remoting/http/HttpBinder.java
deleted file mode 100644
index c0982a08454..00000000000
--- a/dubbo-compatible/src/main/java/com/alibaba/dubbo/remoting/http/HttpBinder.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * 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 com.alibaba.dubbo.remoting.http;
-
-@Deprecated
-public interface HttpBinder extends org.apache.dubbo.remoting.http.HttpBinder {}
diff --git a/dubbo-compatible/src/main/java/com/alibaba/dubbo/rpc/protocol/rest/support/ContentType.java b/dubbo-compatible/src/main/java/com/alibaba/dubbo/rpc/protocol/rest/support/ContentType.java
deleted file mode 100644
index ad2508fa6fa..00000000000
--- a/dubbo-compatible/src/main/java/com/alibaba/dubbo/rpc/protocol/rest/support/ContentType.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * 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 com.alibaba.dubbo.rpc.protocol.rest.support;
-
-@Deprecated
-public class ContentType extends org.apache.dubbo.rpc.protocol.rest.support.ContentType {}
diff --git a/dubbo-compatible/src/test/java/org/apache/dubbo/metadata/annotation/processing/rest/AnnotatedMethodParameterProcessorTest.java b/dubbo-compatible/src/test/java/org/apache/dubbo/metadata/annotation/processing/rest/AnnotatedMethodParameterProcessorTest.java
deleted file mode 100644
index 6db0efb5b5a..00000000000
--- a/dubbo-compatible/src/test/java/org/apache/dubbo/metadata/annotation/processing/rest/AnnotatedMethodParameterProcessorTest.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * 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.annotation.processing.rest;
-
-import org.apache.dubbo.metadata.annotation.processing.AbstractAnnotationProcessingTest;
-import org.apache.dubbo.metadata.rest.RestMethodMetadata;
-
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertNull;
-
-/**
- * The abstract class for {@link AnnotatedMethodParameterProcessor}'s test cases
- *
- * @since 2.7.6
- */
-public abstract class AnnotatedMethodParameterProcessorTest extends AbstractAnnotationProcessingTest {
-
- protected AnnotatedMethodParameterProcessor processor;
-
- protected RestMethodMetadata restMethodMetadata;
-
- protected abstract AnnotatedMethodParameterProcessor createTestInstance();
-
- @BeforeEach
- public final void prepare() {
- this.processor = createTestInstance();
- this.restMethodMetadata = createRestMethodMetadata();
- }
-
- protected RestMethodMetadata createRestMethodMetadata() {
- return new RestMethodMetadata();
- }
-
- protected abstract String getExpectedAnnotationType();
-
- @Test
- void testGetAnnotationType() {
- String expectedAnnotationType = getExpectedAnnotationType();
- assertNull(processor.getAnnotationType());
- assertEquals(expectedAnnotationType, processor.getAnnotationType());
- }
-}
diff --git a/dubbo-compatible/src/test/java/org/apache/dubbo/metadata/annotation/processing/util/AnnotationUtilsTest.java b/dubbo-compatible/src/test/java/org/apache/dubbo/metadata/annotation/processing/util/AnnotationUtilsTest.java
index 18814dc2732..3dfa820a1f6 100644
--- a/dubbo-compatible/src/test/java/org/apache/dubbo/metadata/annotation/processing/util/AnnotationUtilsTest.java
+++ b/dubbo-compatible/src/test/java/org/apache/dubbo/metadata/annotation/processing/util/AnnotationUtilsTest.java
@@ -18,14 +18,12 @@
import org.apache.dubbo.config.annotation.Service;
import org.apache.dubbo.metadata.annotation.processing.AbstractAnnotationProcessingTest;
-import org.apache.dubbo.metadata.rest.SpringRestService;
import org.apache.dubbo.metadata.tools.TestService;
import org.apache.dubbo.metadata.tools.TestServiceImpl;
import javax.annotation.processing.ProcessingEnvironment;
import javax.lang.model.element.AnnotationMirror;
import javax.lang.model.element.Element;
-import javax.lang.model.element.ExecutableElement;
import javax.lang.model.element.TypeElement;
import javax.lang.model.type.TypeMirror;
import javax.ws.rs.Path;
@@ -35,7 +33,6 @@
import java.util.Set;
import org.junit.jupiter.api.Test;
-import org.springframework.web.bind.annotation.GetMapping;
import static org.apache.dubbo.metadata.annotation.processing.util.AnnotationUtils.findAnnotation;
import static org.apache.dubbo.metadata.annotation.processing.util.AnnotationUtils.findMetaAnnotation;
@@ -45,9 +42,7 @@
import static org.apache.dubbo.metadata.annotation.processing.util.AnnotationUtils.getAttribute;
import static org.apache.dubbo.metadata.annotation.processing.util.AnnotationUtils.getValue;
import static org.apache.dubbo.metadata.annotation.processing.util.AnnotationUtils.isAnnotationPresent;
-import static org.apache.dubbo.metadata.annotation.processing.util.MethodUtils.findMethod;
import static org.apache.dubbo.metadata.annotation.processing.util.MethodUtils.getAllDeclaredMethods;
-import static org.junit.jupiter.api.Assertions.assertArrayEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
@@ -241,13 +236,6 @@ void testGetAttribute() {
assertNull(getAttribute(findAnnotation(testType, Path.class), null));
assertNull(getAttribute(findAnnotation(testType, (Class) null), null));
-
- ExecutableElement method = findMethod(getType(SpringRestService.class), "param", String.class);
-
- AnnotationMirror annotation = findAnnotation(method, GetMapping.class);
-
- assertArrayEquals(new String[] {"/param"}, (String[]) getAttribute(annotation, "value"));
- assertNull(getAttribute(annotation, "path"));
}
@Test
diff --git a/dubbo-compatible/src/test/java/org/apache/dubbo/metadata/tools/DefaultRestServiceTest.java b/dubbo-compatible/src/test/java/org/apache/dubbo/metadata/tools/DefaultRestServiceTest.java
deleted file mode 100644
index 9b020d2ca4d..00000000000
--- a/dubbo-compatible/src/test/java/org/apache/dubbo/metadata/tools/DefaultRestServiceTest.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * 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.tools;
-
-import org.apache.dubbo.metadata.rest.DefaultRestService;
-import org.apache.dubbo.metadata.rest.RestService;
-import org.apache.dubbo.metadata.rest.SpringRestService;
-import org.apache.dubbo.metadata.rest.StandardRestService;
-import org.apache.dubbo.metadata.rest.User;
-
-import java.io.IOException;
-
-import org.junit.jupiter.api.Test;
-
-/**
- * The test case for {@link DefaultRestService}
- *
- * @since 2.7.6
- */
-class DefaultRestServiceTest {
-
- @Test
- void test() throws IOException {
- Compiler compiler = new Compiler();
- compiler.compile(
- User.class,
- RestService.class,
- DefaultRestService.class,
- SpringRestService.class,
- StandardRestService.class);
- }
-}
diff --git a/dubbo-compatible/src/test/java/org/apache/dubbo/metadata/tools/RestServiceTest.java b/dubbo-compatible/src/test/java/org/apache/dubbo/metadata/tools/RestServiceTest.java
deleted file mode 100644
index b8ea68c957f..00000000000
--- a/dubbo-compatible/src/test/java/org/apache/dubbo/metadata/tools/RestServiceTest.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * 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.tools;
-
-import org.apache.dubbo.metadata.rest.RestService;
-import org.apache.dubbo.metadata.rest.SpringRestService;
-import org.apache.dubbo.metadata.rest.StandardRestService;
-import org.apache.dubbo.metadata.rest.User;
-
-import java.io.IOException;
-
-import org.junit.jupiter.api.Test;
-
-/**
- * {@link RestService} Test
- *
- * @since 2.7.6
- */
-class RestServiceTest {
-
- @Test
- void test() throws IOException {
- Compiler compiler = new Compiler();
- compiler.compile(User.class, RestService.class, StandardRestService.class, SpringRestService.class);
- }
-}
diff --git a/dubbo-compatible/src/test/java/org/apache/dubbo/metadata/tools/SpringRestServiceTest.java b/dubbo-compatible/src/test/java/org/apache/dubbo/metadata/tools/SpringRestServiceTest.java
deleted file mode 100644
index 5871c21fefe..00000000000
--- a/dubbo-compatible/src/test/java/org/apache/dubbo/metadata/tools/SpringRestServiceTest.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * 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.tools;
-
-import org.apache.dubbo.metadata.rest.RestService;
-import org.apache.dubbo.metadata.rest.SpringRestService;
-import org.apache.dubbo.metadata.rest.User;
-
-import java.io.IOException;
-
-import org.junit.jupiter.api.Test;
-
-/**
- * {@link SpringRestService} Test
- *
- * @since 2.7.6
- */
-class SpringRestServiceTest {
-
- @Test
- void test() throws IOException {
- Compiler compiler = new Compiler();
- compiler.compile(User.class, RestService.class, SpringRestService.class);
- }
-}
diff --git a/dubbo-compatible/src/test/java/org/apache/dubbo/metadata/tools/StandardRestServiceTest.java b/dubbo-compatible/src/test/java/org/apache/dubbo/metadata/tools/StandardRestServiceTest.java
deleted file mode 100644
index 84c8199dc7d..00000000000
--- a/dubbo-compatible/src/test/java/org/apache/dubbo/metadata/tools/StandardRestServiceTest.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * 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.tools;
-
-import org.apache.dubbo.metadata.rest.RestService;
-import org.apache.dubbo.metadata.rest.StandardRestService;
-import org.apache.dubbo.metadata.rest.User;
-
-import java.io.IOException;
-
-import org.junit.jupiter.api.Test;
-
-/**
- * The test case for {@link StandardRestService}
- *
- * @since 2.7.6
- */
-class StandardRestServiceTest {
-
- @Test
- void test() throws IOException {
- Compiler compiler = new Compiler();
- compiler.compile(User.class, RestService.class, StandardRestService.class);
- }
-}
diff --git a/dubbo-config/dubbo-config-api/pom.xml b/dubbo-config/dubbo-config-api/pom.xml
index 12490c4d9ea..bd7b28ed350 100644
--- a/dubbo-config/dubbo-config-api/pom.xml
+++ b/dubbo-config/dubbo-config-api/pom.xml
@@ -108,13 +108,6 @@
test
-
- org.apache.dubbo
- dubbo-rpc-rest
- ${project.parent.version}
- test
-
-
org.apache.dubbodubbo-remoting-netty4
diff --git a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/DubboServiceConsumerBootstrap.java b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/DubboServiceConsumerBootstrap.java
deleted file mode 100644
index 1c3f5fd96c9..00000000000
--- a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/DubboServiceConsumerBootstrap.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * 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.config.bootstrap;
-
-import org.apache.dubbo.config.MetadataReportConfig;
-import org.apache.dubbo.config.bootstrap.rest.UserService;
-import org.apache.dubbo.test.check.registrycenter.config.ZookeeperRegistryCenterConfig;
-
-/**
- * Dubbo Provider Bootstrap
- *
- * @since 2.7.5
- */
-public class DubboServiceConsumerBootstrap {
-
- public static void main(String[] args) throws Exception {
-
- DubboBootstrap bootstrap = DubboBootstrap.getInstance()
- .application("dubbo-consumer-demo")
- .protocol(builder -> builder.port(20887).name("dubbo"))
- .registry(
- "zookeeper",
- builder -> builder.address(ZookeeperRegistryCenterConfig.getConnectionAddress()
- + "?registry-type=service&subscribed-services=dubbo-provider-demo"))
- .metadataReport(new MetadataReportConfig(ZookeeperRegistryCenterConfig.getConnectionAddress()))
- .reference("echo", builder -> builder.interfaceClass(EchoService.class)
- .protocol("dubbo"))
- .reference("user", builder -> builder.interfaceClass(UserService.class)
- .protocol("rest"))
- .start();
-
- EchoService echoService = bootstrap.getCache().get(EchoService.class);
-
- for (int i = 0; i < 500; i++) {
- Thread.sleep(2000L);
- System.out.println(echoService.echo("Hello,World"));
- }
- }
-}
diff --git a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/DubboServiceProviderBootstrap.java b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/DubboServiceProviderBootstrap.java
deleted file mode 100644
index 2fef821a9b5..00000000000
--- a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/DubboServiceProviderBootstrap.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * 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.config.bootstrap;
-
-import org.apache.dubbo.config.ApplicationConfig;
-import org.apache.dubbo.config.MetadataReportConfig;
-import org.apache.dubbo.config.ProtocolConfig;
-import org.apache.dubbo.config.RegistryConfig;
-import org.apache.dubbo.config.ServiceConfig;
-import org.apache.dubbo.config.bootstrap.rest.UserService;
-import org.apache.dubbo.config.bootstrap.rest.UserServiceImpl;
-import org.apache.dubbo.test.check.registrycenter.config.ZookeeperRegistryCenterConfig;
-
-import java.util.Arrays;
-
-/**
- * Dubbo Provider Bootstrap
- *
- * @since 2.7.5
- */
-public class DubboServiceProviderBootstrap {
-
- public static void main(String[] args) {
- multipleRegistries();
- }
-
- private static void multipleRegistries() {
- ProtocolConfig restProtocol = new ProtocolConfig();
- restProtocol.setName("rest");
- restProtocol.setId("rest");
- restProtocol.setPort(-1);
-
- RegistryConfig interfaceRegistry = new RegistryConfig();
- interfaceRegistry.setId("interfaceRegistry");
- interfaceRegistry.setAddress(ZookeeperRegistryCenterConfig.getConnectionAddress());
-
- RegistryConfig serviceRegistry = new RegistryConfig();
- serviceRegistry.setId("serviceRegistry");
- serviceRegistry.setAddress(ZookeeperRegistryCenterConfig.getConnectionAddress() + "?registry-type=service");
-
- ServiceConfig echoService = new ServiceConfig<>();
- echoService.setInterface(EchoService.class.getName());
- echoService.setRef(new EchoServiceImpl());
-
- ServiceConfig userService = new ServiceConfig<>();
- userService.setInterface(UserService.class.getName());
- userService.setRef(new UserServiceImpl());
- userService.setProtocol(restProtocol);
-
- ApplicationConfig applicationConfig = new ApplicationConfig("dubbo-provider-demo");
- applicationConfig.setMetadataType("remote");
- DubboBootstrap.getInstance()
- .application(applicationConfig)
- .registries(Arrays.asList(interfaceRegistry, serviceRegistry))
- .protocol(builder -> builder.port(-1).name("dubbo"))
- .metadataReport(new MetadataReportConfig(ZookeeperRegistryCenterConfig.getConnectionAddress()))
- .service(echoService)
- .service(userService)
- .start()
- .await();
- }
-
- private static void testSCCallDubbo() {}
-
- private static void testDubboCallSC() {}
-
- private static void testDubboTansormation() {}
-}
diff --git a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/DubboServiceProviderMinimumBootstrap.java b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/DubboServiceProviderMinimumBootstrap.java
deleted file mode 100644
index f291f5a821c..00000000000
--- a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/DubboServiceProviderMinimumBootstrap.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * 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.config.bootstrap;
-
-import org.apache.dubbo.config.bootstrap.rest.UserService;
-import org.apache.dubbo.config.bootstrap.rest.UserServiceImpl;
-import org.apache.dubbo.test.check.registrycenter.config.ZookeeperRegistryCenterConfig;
-
-/**
- * TODO
- */
-public class DubboServiceProviderMinimumBootstrap {
-
- public static void main(String[] args) {
- DubboBootstrap.getInstance()
- .application("dubbo-provider-demo")
- .registry(builder -> builder.address(
- ZookeeperRegistryCenterConfig.getConnectionAddress() + "?registry-type=service"))
- .protocol(builder -> builder.port(-1).name("dubbo"))
- .service("echo", builder -> builder.interfaceClass(EchoService.class)
- .ref(new EchoServiceImpl()))
- .service("user", builder -> builder.interfaceClass(UserService.class)
- .ref(new UserServiceImpl()))
- .start()
- .await();
- }
-}
diff --git a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/NacosDubboServiceConsumerBootstrap.java b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/NacosDubboServiceConsumerBootstrap.java
deleted file mode 100644
index 98603b8d479..00000000000
--- a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/NacosDubboServiceConsumerBootstrap.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * 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.config.bootstrap;
-
-import org.apache.dubbo.config.ApplicationConfig;
-import org.apache.dubbo.config.bootstrap.rest.UserService;
-
-import static org.apache.dubbo.common.constants.CommonConstants.REMOTE_METADATA_STORAGE_TYPE;
-
-/**
- * Dubbo Provider Bootstrap
- *
- * @since 2.7.5
- */
-public class NacosDubboServiceConsumerBootstrap {
-
- public static void main(String[] args) throws Exception {
-
- ApplicationConfig applicationConfig = new ApplicationConfig("dubbo-nacos-consumer-demo");
- applicationConfig.setMetadataType(REMOTE_METADATA_STORAGE_TYPE);
- DubboBootstrap bootstrap = DubboBootstrap.getInstance()
- .application(applicationConfig)
- // Nacos in service registry type
- .registry("nacos", builder -> builder.address("nacos://127.0.0.1:8848?registry-type=service")
- .useAsConfigCenter(true)
- .useAsMetadataCenter(true))
- // Nacos in traditional registry type
- // .registry("nacos-traditional", builder -> builder.address("nacos://127.0.0.1:8848"))
- .reference("echo", builder -> builder.interfaceClass(EchoService.class)
- .protocol("dubbo"))
- .reference("user", builder -> builder.interfaceClass(UserService.class)
- .protocol("rest"))
- .start();
-
- EchoService echoService = bootstrap.getCache().get(EchoService.class);
- UserService userService = bootstrap.getCache().get(UserService.class);
-
- for (int i = 0; i < 5; i++) {
- Thread.sleep(2000L);
- System.out.println(echoService.echo("Hello,World"));
- System.out.println(userService.getUser(i * 1L));
- }
- }
-}
diff --git a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/NacosDubboServiceProviderBootstrap.java b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/NacosDubboServiceProviderBootstrap.java
deleted file mode 100644
index ad5911c1822..00000000000
--- a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/NacosDubboServiceProviderBootstrap.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * 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.config.bootstrap;
-
-import org.apache.dubbo.config.ApplicationConfig;
-import org.apache.dubbo.config.bootstrap.rest.UserService;
-import org.apache.dubbo.config.bootstrap.rest.UserServiceImpl;
-
-import static org.apache.dubbo.common.constants.CommonConstants.REMOTE_METADATA_STORAGE_TYPE;
-import static org.apache.dubbo.common.constants.RegistryConstants.REGISTRY_TYPE_KEY;
-import static org.apache.dubbo.common.constants.RegistryConstants.SERVICE_REGISTRY_TYPE;
-
-/**
- * Dubbo Provider Bootstrap
- *
- * @since 2.7.5
- */
-public class NacosDubboServiceProviderBootstrap {
-
- public static void main(String[] args) {
- ApplicationConfig applicationConfig = new ApplicationConfig("dubbo-nacos-provider-demo");
- applicationConfig.setMetadataType(REMOTE_METADATA_STORAGE_TYPE);
- DubboBootstrap.getInstance()
- .application(applicationConfig)
- // Nacos in service registry type
- .registry("nacos", builder -> builder.address("nacos://127.0.0.1:8848?username=nacos&password=nacos")
- .parameter(REGISTRY_TYPE_KEY, SERVICE_REGISTRY_TYPE))
- // Nacos in traditional registry type
- // .registry("nacos-traditional", builder -> builder.address("nacos://127.0.0.1:8848"))
- .protocol("dubbo", builder -> builder.port(20885).name("dubbo"))
- .protocol("rest", builder -> builder.port(9090).name("rest"))
- .service(builder -> builder.id("echo")
- .interfaceClass(EchoService.class)
- .ref(new EchoServiceImpl())
- .protocolIds("dubbo"))
- .service(builder -> builder.id("user")
- .interfaceClass(UserService.class)
- .ref(new UserServiceImpl())
- .protocolIds("rest"))
- .start()
- .await();
- }
-}
diff --git a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/ZookeeperDubboServiceConsumerBootstrap.java b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/ZookeeperDubboServiceConsumerBootstrap.java
deleted file mode 100644
index 657120a2114..00000000000
--- a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/ZookeeperDubboServiceConsumerBootstrap.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * 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.config.bootstrap;
-
-import org.apache.dubbo.config.bootstrap.rest.UserService;
-import org.apache.dubbo.test.check.registrycenter.config.ZookeeperRegistryCenterConfig;
-
-import static org.apache.dubbo.common.constants.CommonConstants.COMPOSITE_METADATA_STORAGE_TYPE;
-import static org.apache.dubbo.common.constants.RegistryConstants.REGISTRY_TYPE_KEY;
-import static org.apache.dubbo.common.constants.RegistryConstants.SERVICE_REGISTRY_TYPE;
-
-/**
- * Dubbo Provider Bootstrap
- *
- * @since 2.7.5
- */
-public class ZookeeperDubboServiceConsumerBootstrap {
-
- public static void main(String[] args) throws Exception {
-
- DubboBootstrap bootstrap = DubboBootstrap.getInstance()
- .application("zookeeper-dubbo-consumer", app -> app.metadata(COMPOSITE_METADATA_STORAGE_TYPE))
- .registry("zookeeper", builder -> builder.address(ZookeeperRegistryCenterConfig.getConnectionAddress())
- .parameter(REGISTRY_TYPE_KEY, SERVICE_REGISTRY_TYPE)
- .useAsConfigCenter(true)
- .useAsMetadataCenter(true))
- .reference("echo", builder -> builder.interfaceClass(EchoService.class)
- .protocol("dubbo")
- .services("zookeeper-dubbo-provider"))
- .reference("user", builder -> builder.interfaceClass(UserService.class)
- .protocol("rest"))
- .start();
-
- EchoService echoService = bootstrap.getCache().get(EchoService.class);
- UserService userService = bootstrap.getCache().get(UserService.class);
-
- for (int i = 0; i < 5; i++) {
- Thread.sleep(2000L);
- System.out.println(echoService.echo("Hello,World"));
- System.out.println(userService.getUser(i * 1L));
- }
-
- bootstrap.stop();
- }
-}
diff --git a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/ZookeeperDubboServiceProviderBootstrap.java b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/ZookeeperDubboServiceProviderBootstrap.java
deleted file mode 100644
index 927716f8130..00000000000
--- a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/ZookeeperDubboServiceProviderBootstrap.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * 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.config.bootstrap;
-
-import org.apache.dubbo.config.bootstrap.rest.UserService;
-import org.apache.dubbo.config.bootstrap.rest.UserServiceImpl;
-
-import static org.apache.dubbo.common.constants.CommonConstants.COMPOSITE_METADATA_STORAGE_TYPE;
-import static org.apache.dubbo.common.constants.RegistryConstants.REGISTRY_TYPE_KEY;
-import static org.apache.dubbo.common.constants.RegistryConstants.SERVICE_REGISTRY_TYPE;
-
-/**
- * TODO
- */
-public class ZookeeperDubboServiceProviderBootstrap {
-
- public static void main(String[] args) {
- DubboBootstrap.getInstance()
- .application("zookeeper-dubbo-provider", app -> app.metadata(COMPOSITE_METADATA_STORAGE_TYPE))
- .registry(builder -> builder.address("127.0.0.1:2181")
- .protocol("zookeeper")
- .parameter(REGISTRY_TYPE_KEY, SERVICE_REGISTRY_TYPE))
- .protocol("dubbo", builder -> builder.port(-1).name("dubbo"))
- .protocol("rest", builder -> builder.port(8081).name("rest"))
- .service("echo", builder -> builder.interfaceClass(EchoService.class)
- .ref(new EchoServiceImpl())
- .protocolIds("dubbo"))
- .service("user", builder -> builder.interfaceClass(UserService.class)
- .ref(new UserServiceImpl())
- .protocolIds("rest"))
- .start()
- .await();
- }
-}
diff --git a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/compatible/DubboInterfaceConsumerBootstrap.java b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/compatible/DubboInterfaceConsumerBootstrap.java
deleted file mode 100644
index 1a0e141f441..00000000000
--- a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/compatible/DubboInterfaceConsumerBootstrap.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * 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.config.bootstrap.compatible;
-
-import org.apache.dubbo.config.RegistryConfig;
-import org.apache.dubbo.config.bootstrap.DubboBootstrap;
-import org.apache.dubbo.config.bootstrap.EchoService;
-import org.apache.dubbo.config.bootstrap.rest.UserService;
-import org.apache.dubbo.test.check.registrycenter.config.ZookeeperRegistryCenterConfig;
-
-/**
- * Dubbo Provider Bootstrap
- *
- * @since 2.7.5
- */
-public class DubboInterfaceConsumerBootstrap {
-
- public static void main(String[] args) throws Exception {
- RegistryConfig interfaceRegistry = new RegistryConfig();
- interfaceRegistry.setId("interfaceRegistry");
- interfaceRegistry.setAddress(ZookeeperRegistryCenterConfig.getConnectionAddress());
-
- DubboBootstrap bootstrap = DubboBootstrap.getInstance()
- .application("dubbo-consumer-demo")
- // Zookeeper
- .registry(interfaceRegistry)
- .reference("echo", builder -> builder.interfaceClass(EchoService.class)
- .protocol("dubbo"))
- .reference("user", builder -> builder.interfaceClass(UserService.class)
- .protocol("rest"))
- .start()
- .await();
-
- EchoService echoService = bootstrap.getCache().get(EchoService.class);
- UserService userService = bootstrap.getCache().get(UserService.class);
-
- for (int i = 0; i < 500; i++) {
- Thread.sleep(2000L);
- System.out.println(echoService.echo("Hello,World"));
- System.out.println(userService.getUser(1L));
- }
- }
-}
diff --git a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/rest/User.java b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/rest/User.java
deleted file mode 100644
index a1586f9955a..00000000000
--- a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/rest/User.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * 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.config.bootstrap.rest;
-
-import javax.validation.constraints.Min;
-import javax.validation.constraints.NotNull;
-import javax.validation.constraints.Size;
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlRootElement;
-
-import java.io.Serializable;
-
-import org.codehaus.jackson.annotate.JsonProperty;
-
-@XmlRootElement
-@XmlAccessorType(XmlAccessType.FIELD)
-public class User implements Serializable {
-
- @NotNull
- @Min(1L)
- private Long id;
-
- @JsonProperty("username")
- @XmlElement(name = "username")
- @NotNull
- @Size(min = 6, max = 50)
- private String name;
-
- public User() {}
-
- public User(Long id, String name) {
- this.id = id;
- this.name = name;
- }
-
- public Long getId() {
- return id;
- }
-
- public void setId(Long id) {
- this.id = id;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- @Override
- public String toString() {
- return "User (" + "id=" + id + ", name='" + name + '\'' + ')';
- }
-}
diff --git a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/rest/UserService.java b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/rest/UserService.java
deleted file mode 100644
index 53400f292ed..00000000000
--- a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/rest/UserService.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * 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.config.bootstrap.rest;
-
-import org.apache.dubbo.rpc.protocol.rest.support.ContentType;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
-
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
-
-@Path("users")
-@Consumes({MediaType.APPLICATION_JSON, MediaType.TEXT_XML})
-@Produces({ContentType.APPLICATION_JSON_UTF_8, ContentType.TEXT_XML_UTF_8})
-@Api(value = "UserService")
-public interface UserService {
-
- @GET
- @Path("{id : \\d+}")
- @ApiOperation(value = "getUser")
- User getUser(@ApiParam(value = "id") @PathParam("id") Long id);
-}
diff --git a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/rest/UserServiceImpl.java b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/rest/UserServiceImpl.java
deleted file mode 100644
index 6d24d6206df..00000000000
--- a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/rest/UserServiceImpl.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * 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.config.bootstrap.rest;
-
-import java.util.concurrent.atomic.AtomicLong;
-
-public class UserServiceImpl implements UserService {
-
- private final AtomicLong idGen = new AtomicLong();
-
- @Override
- public User getUser(Long id) {
- return new User(id, "username" + id);
- }
-}
diff --git a/dubbo-config/dubbo-config-spring/pom.xml b/dubbo-config/dubbo-config-spring/pom.xml
index 0c14921e6e3..b49df8dc0c9 100644
--- a/dubbo-config/dubbo-config-spring/pom.xml
+++ b/dubbo-config/dubbo-config-spring/pom.xml
@@ -95,12 +95,6 @@
${project.parent.version}test
-
- org.apache.dubbo
- dubbo-rpc-rest
- ${project.parent.version}
- test
- org.apache.dubbodubbo-remoting-netty4
diff --git a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/ControllerServiceConfigTest.java b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/ControllerServiceConfigTest.java
index 2d2de09b8da..3ecb212b13a 100644
--- a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/ControllerServiceConfigTest.java
+++ b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/ControllerServiceConfigTest.java
@@ -21,8 +21,10 @@
import org.apache.dubbo.config.ServiceConfig;
import org.apache.dubbo.config.spring.api.SpringControllerService;
+import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
+@Disabled
public class ControllerServiceConfigTest {
@Test
@@ -32,7 +34,7 @@ void testServiceConfig() {
ApplicationConfig applicationConfig = new ApplicationConfig();
applicationConfig.setName("dubbo");
serviceServiceConfig.setApplication(applicationConfig);
- serviceServiceConfig.setProtocol(new ProtocolConfig("rest", 8080));
+ serviceServiceConfig.setProtocol(new ProtocolConfig("dubbo", 8080));
serviceServiceConfig.setRef(new SpringControllerService());
serviceServiceConfig.setInterface(SpringControllerService.class.getName());
serviceServiceConfig.export();
diff --git a/dubbo-demo/dubbo-demo-interface/pom.xml b/dubbo-demo/dubbo-demo-interface/pom.xml
index c01cd37eb7d..0c06266cb1b 100644
--- a/dubbo-demo/dubbo-demo-interface/pom.xml
+++ b/dubbo-demo/dubbo-demo-interface/pom.xml
@@ -33,12 +33,11 @@
+
- org.apache.dubbo
- dubbo-rpc-rest
- ${project.version}
+ javax.ws.rs
+ javax.ws.rs-api
-
org.springframework
@@ -55,5 +54,16 @@
org.apache.logging.log4jlog4j-slf4j-impl
+
+
+ io.swagger
+ swagger-jaxrs
+
+
+ javax.ws.rs
+ jsr311-api
+
+
+
diff --git a/dubbo-demo/dubbo-demo-native/dubbo-demo-native-consumer/pom.xml b/dubbo-demo/dubbo-demo-native/dubbo-demo-native-consumer/pom.xml
index 1b2d730c85a..ab13f35f2d3 100644
--- a/dubbo-demo/dubbo-demo-native/dubbo-demo-native-consumer/pom.xml
+++ b/dubbo-demo/dubbo-demo-native/dubbo-demo-native-consumer/pom.xml
@@ -133,11 +133,6 @@
dubbo-filter-validation${project.version}
-
- org.apache.dubbo
- dubbo-remoting-http
- ${project.version}
- com.alibaba
diff --git a/dubbo-demo/dubbo-demo-native/dubbo-demo-native-provider/pom.xml b/dubbo-demo/dubbo-demo-native/dubbo-demo-native-provider/pom.xml
index da5c091b118..39471b6dbd2 100644
--- a/dubbo-demo/dubbo-demo-native/dubbo-demo-native-provider/pom.xml
+++ b/dubbo-demo/dubbo-demo-native/dubbo-demo-native-provider/pom.xml
@@ -133,12 +133,6 @@
dubbo-filter-validation${project.version}
-
- org.apache.dubbo
- dubbo-remoting-http
- ${project.version}
-
-
com.alibabafastjson
diff --git a/dubbo-demo/dubbo-demo-xml/dubbo-demo-jaxrs-rest-consumer/pom.xml b/dubbo-demo/dubbo-demo-xml/dubbo-demo-jaxrs-rest-consumer/pom.xml
deleted file mode 100644
index e3d58536b82..00000000000
--- a/dubbo-demo/dubbo-demo-xml/dubbo-demo-jaxrs-rest-consumer/pom.xml
+++ /dev/null
@@ -1,156 +0,0 @@
-
-
-
- 4.0.0
-
- org.apache.dubbo
- dubbo-demo-xml
- ${revision}
- ../pom.xml
-
-
- dubbo-demo-jaxrs-rest-consumer
-
- jar
- ${project.artifactId}
- Dubbo JAXRS Rest Consumer Demo
-
-
- true
-
-
-
-
- org.springframework
- spring-context
-
-
- org.springframework
- spring-web
-
-
-
- org.apache.dubbo
- dubbo-registry-multicast
- ${project.version}
-
-
- org.apache.dubbo
- dubbo-registry-zookeeper
- ${project.version}
-
-
- org.apache.dubbo
- dubbo-registry-nacos
- ${project.version}
-
-
- com.alibaba.nacos
- nacos-client
-
-
- org.apache.dubbo
- dubbo-configcenter-zookeeper
- ${project.version}
-
-
- org.apache.dubbo
- dubbo-configcenter-nacos
- ${project.version}
-
-
- org.apache.dubbo
- dubbo-metadata-report-zookeeper
- ${project.version}
-
-
- org.apache.dubbo
- dubbo-metadata-report-nacos
- ${project.version}
-
-
- org.apache.dubbo
- dubbo-rpc-dubbo
- ${project.version}
-
-
- org.apache.dubbo
- dubbo-rpc-rest
- ${project.version}
-
-
- org.apache.dubbo
- dubbo-config-spring
- ${project.version}
-
-
- org.apache.dubbo
- dubbo-remoting-netty4
- ${project.version}
-
-
- org.apache.dubbo
- dubbo-serialization-hessian2
- ${project.version}
-
-
- org.apache.dubbo
- dubbo-serialization-fastjson2
- ${project.version}
-
-
- org.apache.dubbo
- dubbo-serialization-jdk
- ${project.version}
-
-
-
- org.springframework
- spring-test
- test
-
-
-
- org.apache.dubbo
- dubbo-demo-interface
- ${project.version}
-
-
- org.apache.logging.log4j
- log4j-slf4j-impl
-
-
-
-
-
-
- javax.annotation
-
- [1.11,)
-
-
-
- javax.annotation
- javax.annotation-api
- 1.3.2
-
-
-
-
-
-
diff --git a/dubbo-demo/dubbo-demo-xml/dubbo-demo-jaxrs-rest-consumer/src/main/java/org/apache/dubbo/demo/rest/api/RestConsumer.java b/dubbo-demo/dubbo-demo-xml/dubbo-demo-jaxrs-rest-consumer/src/main/java/org/apache/dubbo/demo/rest/api/RestConsumer.java
deleted file mode 100644
index 4b3b306d33b..00000000000
--- a/dubbo-demo/dubbo-demo-xml/dubbo-demo-jaxrs-rest-consumer/src/main/java/org/apache/dubbo/demo/rest/api/RestConsumer.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * 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.demo.rest.api;
-
-import org.apache.dubbo.demo.rest.api.annotation.DubboServiceAnnotationServiceConsumer;
-
-import java.util.Arrays;
-
-import org.jboss.resteasy.specimpl.MultivaluedMapImpl;
-import org.springframework.context.support.ClassPathXmlApplicationContext;
-import po.User;
-
-public class RestConsumer {
-
- public static void main(String[] args) {
- consumerService();
- }
-
- public static void consumerService() {
- ClassPathXmlApplicationContext context =
- new ClassPathXmlApplicationContext(new String[] {"spring/rest-consumer.xml"});
- context.start();
- System.out.println("rest consumer start");
- testExceptionMapperService(context);
- testHttpMethodService(context);
- httpRPCContextTest(context);
- jaxRsRestDemoServiceTest(context);
- annotationTest(context);
- System.out.println("rest consumer test success");
- }
-
- private static void annotationTest(ClassPathXmlApplicationContext context) {
- DubboServiceAnnotationServiceConsumer bean = context.getBean(DubboServiceAnnotationServiceConsumer.class);
- bean.invokeAnnotationService();
- }
-
- private static void jaxRsRestDemoServiceTest(ClassPathXmlApplicationContext context) {
- JaxRsRestDemoService jaxRsRestDemoService = context.getBean("jaxRsRestDemoService", JaxRsRestDemoService.class);
- String hello = jaxRsRestDemoService.sayHello("hello");
- assertEquals("Hello, hello", hello);
- Integer result = jaxRsRestDemoService.primitiveInt(1, 2);
- Long resultLong = jaxRsRestDemoService.primitiveLong(1, 2l);
- long resultByte = jaxRsRestDemoService.primitiveByte((byte) 1, 2l);
- long resultShort = jaxRsRestDemoService.primitiveShort((short) 1, 2l, 1);
-
- assertEquals(result, 3);
- assertEquals(resultShort, 3l);
- assertEquals(resultLong, 3l);
- assertEquals(resultByte, 3l);
-
- assertEquals(Long.valueOf(1l), jaxRsRestDemoService.testFormBody(1l));
-
- MultivaluedMapImpl forms = new MultivaluedMapImpl<>();
- forms.put("form", Arrays.asList("F1"));
-
- assertEquals(Arrays.asList("F1"), jaxRsRestDemoService.testMapForm(forms));
- assertEquals(User.getInstance(), jaxRsRestDemoService.testJavaBeanBody(User.getInstance()));
- }
-
- private static void testExceptionMapperService(ClassPathXmlApplicationContext context) {
- String returnStr = "exception";
- String paramStr = "exception";
- ExceptionMapperService exceptionMapperService =
- context.getBean("exceptionMapperService", ExceptionMapperService.class);
- assertEquals(returnStr, exceptionMapperService.exception(paramStr));
- }
-
- private static void httpRPCContextTest(ClassPathXmlApplicationContext context) {
-
- HttpRequestAndResponseRPCContextService requestAndResponseRPCContextService = context.getBean(
- "httpRequestAndResponseRPCContextService", HttpRequestAndResponseRPCContextService.class);
- String returnStr = "hello";
- String paramStr = "hello";
- assertEquals(returnStr, requestAndResponseRPCContextService.httpRequestHeader(paramStr));
- assertEquals(returnStr, requestAndResponseRPCContextService.httpRequestParam(paramStr));
- assertEquals(
- returnStr,
- requestAndResponseRPCContextService.httpResponseHeader(paramStr).get(0));
- }
-
- private static void testHttpMethodService(ClassPathXmlApplicationContext context) {
- HttpMethodService httpMethodService = context.getBean("httpMethodService", HttpMethodService.class);
- String returnStr = "hello";
- String paramStr = "hello";
- // assertEquals(null, httpMethodService.sayHelloHead(paramStr));
- assertEquals(returnStr, httpMethodService.sayHelloGet(paramStr));
- assertEquals(returnStr, httpMethodService.sayHelloDelete(paramStr));
- assertEquals(returnStr, httpMethodService.sayHelloPut(paramStr));
- assertEquals(returnStr, httpMethodService.sayHelloOptions(paramStr));
- // Assert.assertEquals(returnStr, httpMethodService.sayHelloPatch(paramStr));
- assertEquals(returnStr, httpMethodService.sayHelloPost(paramStr));
- }
-
- private static void assertEquals(Object returnStr, Object exception) {
- boolean equal = returnStr != null && returnStr.equals(exception);
-
- if (equal) {
- return;
- } else {
- throw new RuntimeException();
- }
- }
-}
diff --git a/dubbo-demo/dubbo-demo-xml/dubbo-demo-jaxrs-rest-consumer/src/main/java/org/apache/dubbo/demo/rest/api/annotation/DubboServiceAnnotationServiceConsumer.java b/dubbo-demo/dubbo-demo-xml/dubbo-demo-jaxrs-rest-consumer/src/main/java/org/apache/dubbo/demo/rest/api/annotation/DubboServiceAnnotationServiceConsumer.java
deleted file mode 100644
index dc8f6a5e69d..00000000000
--- a/dubbo-demo/dubbo-demo-xml/dubbo-demo-jaxrs-rest-consumer/src/main/java/org/apache/dubbo/demo/rest/api/annotation/DubboServiceAnnotationServiceConsumer.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * 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.demo.rest.api.annotation;
-
-import org.apache.dubbo.config.annotation.DubboReference;
-import org.apache.dubbo.demo.rest.api.DubboServiceAnnotationService;
-
-import org.springframework.stereotype.Component;
-
-@Component
-public class DubboServiceAnnotationServiceConsumer {
-
- @DubboReference(interfaceClass = DubboServiceAnnotationService.class)
- DubboServiceAnnotationService dubboServiceAnnotationService;
-
- public void invokeAnnotationService() {
- String annotation = dubboServiceAnnotationService.annotation();
- System.out.println(annotation);
- }
-}
diff --git a/dubbo-demo/dubbo-demo-xml/dubbo-demo-jaxrs-rest-consumer/src/main/java/org/apache/dubbo/demo/rest/api/config/DubboConfig.java b/dubbo-demo/dubbo-demo-xml/dubbo-demo-jaxrs-rest-consumer/src/main/java/org/apache/dubbo/demo/rest/api/config/DubboConfig.java
deleted file mode 100644
index 0d9eab4ecb0..00000000000
--- a/dubbo-demo/dubbo-demo-xml/dubbo-demo-jaxrs-rest-consumer/src/main/java/org/apache/dubbo/demo/rest/api/config/DubboConfig.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * 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.demo.rest.api.config;
-
-import org.apache.dubbo.config.spring.context.annotation.DubboComponentScan;
-
-@DubboComponentScan("org.apache.dubbo.demo.rest")
-public class DubboConfig {}
diff --git a/dubbo-demo/dubbo-demo-xml/dubbo-demo-jaxrs-rest-consumer/src/main/resources/log4j2.xml b/dubbo-demo/dubbo-demo-xml/dubbo-demo-jaxrs-rest-consumer/src/main/resources/log4j2.xml
deleted file mode 100644
index 69e1321d220..00000000000
--- a/dubbo-demo/dubbo-demo-xml/dubbo-demo-jaxrs-rest-consumer/src/main/resources/log4j2.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/dubbo-demo/dubbo-demo-xml/dubbo-demo-jaxrs-rest-consumer/src/main/resources/spring/rest-consumer.xml b/dubbo-demo/dubbo-demo-xml/dubbo-demo-jaxrs-rest-consumer/src/main/resources/spring/rest-consumer.xml
deleted file mode 100644
index ea6a63b04f5..00000000000
--- a/dubbo-demo/dubbo-demo-xml/dubbo-demo-jaxrs-rest-consumer/src/main/resources/spring/rest-consumer.xml
+++ /dev/null
@@ -1,48 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/dubbo-demo/dubbo-demo-xml/dubbo-demo-jaxrs-rest-provider/pom.xml b/dubbo-demo/dubbo-demo-xml/dubbo-demo-jaxrs-rest-provider/pom.xml
deleted file mode 100644
index afd7d330bf5..00000000000
--- a/dubbo-demo/dubbo-demo-xml/dubbo-demo-jaxrs-rest-provider/pom.xml
+++ /dev/null
@@ -1,156 +0,0 @@
-
-
-
- 4.0.0
-
- org.apache.dubbo
- dubbo-demo-xml
- ${revision}
- ../pom.xml
-
-
- dubbo-demo-jaxrs-rest-provider
-
- jar
- ${project.artifactId}
- Dubbo JAXRS Rest Provider Demo
-
-
- true
-
-
-
-
- org.springframework
- spring-context
-
-
- org.springframework
- spring-web
-
-
-
- org.apache.dubbo
- dubbo-registry-multicast
- ${project.version}
-
-
- org.apache.dubbo
- dubbo-registry-zookeeper
- ${project.version}
-
-
- org.apache.dubbo
- dubbo-registry-nacos
- ${project.version}
-
-
- com.alibaba.nacos
- nacos-client
-
-
- org.apache.dubbo
- dubbo-configcenter-zookeeper
- ${project.version}
-
-
- org.apache.dubbo
- dubbo-configcenter-nacos
- ${project.version}
-
-
- org.apache.dubbo
- dubbo-metadata-report-zookeeper
- ${project.version}
-
-
- org.apache.dubbo
- dubbo-metadata-report-nacos
- ${project.version}
-
-
- org.apache.dubbo
- dubbo-rpc-dubbo
- ${project.version}
-
-
- org.apache.dubbo
- dubbo-rpc-rest
- ${project.version}
-
-
- org.apache.dubbo
- dubbo-config-spring
- ${project.version}
-
-
- org.apache.dubbo
- dubbo-remoting-netty4
- ${project.version}
-
-
- org.apache.dubbo
- dubbo-serialization-hessian2
- ${project.version}
-
-
- org.apache.dubbo
- dubbo-serialization-fastjson2
- ${project.version}
-
-
- org.apache.dubbo
- dubbo-serialization-jdk
- ${project.version}
-
-
-
- org.springframework
- spring-test
- test
-
-
-
- org.apache.dubbo
- dubbo-demo-interface
- ${project.version}
-
-
- org.apache.logging.log4j
- log4j-slf4j-impl
-
-
-
-
-
-
- javax.annotation
-
- [1.11,)
-
-
-
- javax.annotation
- javax.annotation-api
- 1.3.2
-
-
-
-
-
-
diff --git a/dubbo-demo/dubbo-demo-xml/dubbo-demo-jaxrs-rest-provider/src/main/java/org/apache/dubbo/demo/rest/api/RestProvider.java b/dubbo-demo/dubbo-demo-xml/dubbo-demo-jaxrs-rest-provider/src/main/java/org/apache/dubbo/demo/rest/api/RestProvider.java
deleted file mode 100644
index d4cdbe038bf..00000000000
--- a/dubbo-demo/dubbo-demo-xml/dubbo-demo-jaxrs-rest-provider/src/main/java/org/apache/dubbo/demo/rest/api/RestProvider.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * 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.demo.rest.api;
-
-import org.springframework.context.support.ClassPathXmlApplicationContext;
-
-public class RestProvider {
-
- public static void main(String[] args) throws Exception {
- ClassPathXmlApplicationContext context =
- new ClassPathXmlApplicationContext(new String[] {"spring/rest-provider.xml"});
-
- context.refresh();
-
- // SpringControllerService springControllerService = context.getBean(SpringControllerService.class);
- // ServiceConfig serviceConfig = new ServiceConfig<>();
- // serviceConfig.setInterface(SpringControllerService.class);
- // serviceConfig.setProtocol(new ProtocolConfig("rest", 8888));
- // serviceConfig.setRef(springControllerService);
- // serviceConfig.export();
-
- System.out.println("dubbo service started");
-
- System.in.read();
- }
-}
diff --git a/dubbo-demo/dubbo-demo-xml/dubbo-demo-jaxrs-rest-provider/src/main/java/org/apache/dubbo/demo/rest/api/config/DubboConfig.java b/dubbo-demo/dubbo-demo-xml/dubbo-demo-jaxrs-rest-provider/src/main/java/org/apache/dubbo/demo/rest/api/config/DubboConfig.java
deleted file mode 100644
index 0d9eab4ecb0..00000000000
--- a/dubbo-demo/dubbo-demo-xml/dubbo-demo-jaxrs-rest-provider/src/main/java/org/apache/dubbo/demo/rest/api/config/DubboConfig.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * 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.demo.rest.api.config;
-
-import org.apache.dubbo.config.spring.context.annotation.DubboComponentScan;
-
-@DubboComponentScan("org.apache.dubbo.demo.rest")
-public class DubboConfig {}
diff --git a/dubbo-demo/dubbo-demo-xml/dubbo-demo-jaxrs-rest-provider/src/main/java/org/apache/dubbo/demo/rest/api/extension/ExceptionMapperForTest.java b/dubbo-demo/dubbo-demo-xml/dubbo-demo-jaxrs-rest-provider/src/main/java/org/apache/dubbo/demo/rest/api/extension/ExceptionMapperForTest.java
deleted file mode 100644
index 2fe7fe3641a..00000000000
--- a/dubbo-demo/dubbo-demo-xml/dubbo-demo-jaxrs-rest-provider/src/main/java/org/apache/dubbo/demo/rest/api/extension/ExceptionMapperForTest.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * 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.demo.rest.api.extension;
-
-import org.apache.dubbo.rpc.protocol.rest.exception.mapper.ExceptionHandler;
-
-public class ExceptionMapperForTest implements ExceptionHandler {
-
- @Override
- public Object result(RuntimeException exception) {
- return exception.getMessage();
- }
-}
diff --git a/dubbo-demo/dubbo-demo-xml/dubbo-demo-jaxrs-rest-provider/src/main/java/org/apache/dubbo/demo/rest/api/impl/CurlServiceImpl.java b/dubbo-demo/dubbo-demo-xml/dubbo-demo-jaxrs-rest-provider/src/main/java/org/apache/dubbo/demo/rest/api/impl/CurlServiceImpl.java
deleted file mode 100644
index dcb3b535583..00000000000
--- a/dubbo-demo/dubbo-demo-xml/dubbo-demo-jaxrs-rest-provider/src/main/java/org/apache/dubbo/demo/rest/api/impl/CurlServiceImpl.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * 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.demo.rest.api.impl;
-
-import org.apache.dubbo.config.annotation.DubboService;
-import org.apache.dubbo.demo.rest.api.CurlService;
-
-@DubboService(interfaceClass = CurlService.class, protocol = "rest")
-public class CurlServiceImpl implements CurlService {
-
- @Override
- public String curl() {
- return "hello,dubbo rest curl request";
- }
-}
diff --git a/dubbo-demo/dubbo-demo-xml/dubbo-demo-jaxrs-rest-provider/src/main/java/org/apache/dubbo/demo/rest/api/impl/DubboServiceAnnotationServiceImpl.java b/dubbo-demo/dubbo-demo-xml/dubbo-demo-jaxrs-rest-provider/src/main/java/org/apache/dubbo/demo/rest/api/impl/DubboServiceAnnotationServiceImpl.java
deleted file mode 100644
index 823af088f7e..00000000000
--- a/dubbo-demo/dubbo-demo-xml/dubbo-demo-jaxrs-rest-provider/src/main/java/org/apache/dubbo/demo/rest/api/impl/DubboServiceAnnotationServiceImpl.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * 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.demo.rest.api.impl;
-
-import org.apache.dubbo.config.annotation.DubboService;
-import org.apache.dubbo.demo.rest.api.DubboServiceAnnotationService;
-
-@DubboService(protocol = "rest")
-public class DubboServiceAnnotationServiceImpl implements DubboServiceAnnotationService {
- @Override
- public String annotation() {
- return "Dubbo Service Annotation service demo!";
- }
-}
diff --git a/dubbo-demo/dubbo-demo-xml/dubbo-demo-jaxrs-rest-provider/src/main/java/org/apache/dubbo/demo/rest/api/impl/ExceptionMapperServiceImpl.java b/dubbo-demo/dubbo-demo-xml/dubbo-demo-jaxrs-rest-provider/src/main/java/org/apache/dubbo/demo/rest/api/impl/ExceptionMapperServiceImpl.java
deleted file mode 100644
index d8a84cc9324..00000000000
--- a/dubbo-demo/dubbo-demo-xml/dubbo-demo-jaxrs-rest-provider/src/main/java/org/apache/dubbo/demo/rest/api/impl/ExceptionMapperServiceImpl.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * 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.demo.rest.api.impl;
-
-import org.apache.dubbo.demo.rest.api.ExceptionMapperService;
-
-import org.springframework.stereotype.Service;
-
-@Service("exceptionMapperService")
-public class ExceptionMapperServiceImpl implements ExceptionMapperService {
-
- @Override
- public String exception(String message) {
-
- throw new RuntimeException(message);
- }
-}
diff --git a/dubbo-demo/dubbo-demo-xml/dubbo-demo-jaxrs-rest-provider/src/main/java/org/apache/dubbo/demo/rest/api/impl/HttpMethodServiceImpl.java b/dubbo-demo/dubbo-demo-xml/dubbo-demo-jaxrs-rest-provider/src/main/java/org/apache/dubbo/demo/rest/api/impl/HttpMethodServiceImpl.java
deleted file mode 100644
index 24fc704becd..00000000000
--- a/dubbo-demo/dubbo-demo-xml/dubbo-demo-jaxrs-rest-provider/src/main/java/org/apache/dubbo/demo/rest/api/impl/HttpMethodServiceImpl.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * 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.demo.rest.api.impl;
-
-import org.apache.dubbo.demo.rest.api.HttpMethodService;
-
-import org.springframework.stereotype.Service;
-
-@Service("httpMethodService")
-public class HttpMethodServiceImpl implements HttpMethodService {
-
- @Override
- public String sayHelloPost(String hello) {
- return hello;
- }
-
- @Override
- public String sayHelloDelete(String hello) {
- return hello;
- }
-
- @Override
- public String sayHelloHead(String hello) {
- return hello;
- }
-
- @Override
- public String sayHelloGet(String hello) {
- return hello;
- }
-
- @Override
- public String sayHelloPut(String hello) {
- return hello;
- }
-
- @Override
- public String sayHelloPatch(String hello) {
- return hello;
- }
-
- @Override
- public String sayHelloOptions(String hello) {
- return hello;
- }
-}
diff --git a/dubbo-demo/dubbo-demo-xml/dubbo-demo-jaxrs-rest-provider/src/main/java/org/apache/dubbo/demo/rest/api/impl/HttpRequestAndResponseRPCContextServiceImpl.java b/dubbo-demo/dubbo-demo-xml/dubbo-demo-jaxrs-rest-provider/src/main/java/org/apache/dubbo/demo/rest/api/impl/HttpRequestAndResponseRPCContextServiceImpl.java
deleted file mode 100644
index 8c12038cf44..00000000000
--- a/dubbo-demo/dubbo-demo-xml/dubbo-demo-jaxrs-rest-provider/src/main/java/org/apache/dubbo/demo/rest/api/impl/HttpRequestAndResponseRPCContextServiceImpl.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * 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.demo.rest.api.impl;
-
-import org.apache.dubbo.demo.rest.api.HttpRequestAndResponseRPCContextService;
-import org.apache.dubbo.rpc.RpcContext;
-import org.apache.dubbo.rpc.protocol.rest.netty.NettyHttpResponse;
-import org.apache.dubbo.rpc.protocol.rest.request.RequestFacade;
-
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-
-import org.springframework.stereotype.Service;
-
-@Service("httpRequestAndResponseRPCContextService")
-public class HttpRequestAndResponseRPCContextServiceImpl implements HttpRequestAndResponseRPCContextService {
- @Override
- public String httpRequestParam(String hello) {
- Object request = RpcContext.getServerAttachment().getRequest();
- return ((RequestFacade) request).getParameter("name");
- }
-
- @Override
- public String httpRequestHeader(String hello) {
- Object request = RpcContext.getServerAttachment().getRequest();
- return ((RequestFacade) request).getHeader("header");
- }
-
- @Override
- public List httpResponseHeader(String hello) {
- Object response = RpcContext.getServerAttachment().getResponse();
- Map> outputHeaders = ((NettyHttpResponse) response).getOutputHeaders();
- String responseKey = "response";
- outputHeaders.put(responseKey, Arrays.asList(hello));
-
- return outputHeaders.get(responseKey);
- }
-}
diff --git a/dubbo-demo/dubbo-demo-xml/dubbo-demo-jaxrs-rest-provider/src/main/java/org/apache/dubbo/demo/rest/api/impl/JaxRsRestDemoServiceImpl.java b/dubbo-demo/dubbo-demo-xml/dubbo-demo-jaxrs-rest-provider/src/main/java/org/apache/dubbo/demo/rest/api/impl/JaxRsRestDemoServiceImpl.java
deleted file mode 100644
index 06ec4fdbb9a..00000000000
--- a/dubbo-demo/dubbo-demo-xml/dubbo-demo-jaxrs-rest-provider/src/main/java/org/apache/dubbo/demo/rest/api/impl/JaxRsRestDemoServiceImpl.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * 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.demo.rest.api.impl;
-
-import org.apache.dubbo.demo.rest.api.JaxRsRestDemoService;
-
-import javax.ws.rs.core.MultivaluedMap;
-
-import java.util.List;
-import java.util.Map;
-
-import org.springframework.stereotype.Service;
-import po.User;
-
-@Service("jaxRsRestDemoService")
-public class JaxRsRestDemoServiceImpl implements JaxRsRestDemoService {
-
- @Override
- public String sayHello(String name) {
- return "Hello, " + name;
- }
-
- @Override
- public Long testFormBody(Long number) {
- return number;
- }
-
- @Override
- public User testJavaBeanBody(User user) {
- return user;
- }
-
- @Override
- public int primitiveInt(int a, int b) {
- return a + b;
- }
-
- @Override
- public long primitiveLong(long a, Long b) {
- return a + b;
- }
-
- @Override
- public long primitiveByte(byte a, Long b) {
- return a + b;
- }
-
- @Override
- public long primitiveShort(short a, Long b, int c) {
- return a + b;
- }
-
- @Override
- public String testMapParam(Map params) {
- return params.get("param");
- }
-
- @Override
- public String testMapHeader(Map headers) {
- return headers.get("header");
- }
-
- @Override
- public List testMapForm(MultivaluedMap params) {
- return params.get("form");
- }
-
- @Override
- public String header(String header) {
- return header;
- }
-
- @Override
- public int headerInt(int header) {
- return header;
- }
-
- @Override
- public Integer hello(Integer a, Integer b) {
- return a + b;
- }
-
- @Override
- public String error() {
- throw new RuntimeException("test error");
- }
-}
diff --git a/dubbo-demo/dubbo-demo-xml/dubbo-demo-jaxrs-rest-provider/src/main/resources/log4j2.xml b/dubbo-demo/dubbo-demo-xml/dubbo-demo-jaxrs-rest-provider/src/main/resources/log4j2.xml
deleted file mode 100644
index 69e1321d220..00000000000
--- a/dubbo-demo/dubbo-demo-xml/dubbo-demo-jaxrs-rest-provider/src/main/resources/log4j2.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/dubbo-demo/dubbo-demo-xml/dubbo-demo-jaxrs-rest-provider/src/main/resources/spring/rest-provider.xml b/dubbo-demo/dubbo-demo-xml/dubbo-demo-jaxrs-rest-provider/src/main/resources/spring/rest-provider.xml
deleted file mode 100644
index f0471d1dc7c..00000000000
--- a/dubbo-demo/dubbo-demo-xml/dubbo-demo-jaxrs-rest-provider/src/main/resources/spring/rest-provider.xml
+++ /dev/null
@@ -1,58 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/dubbo-demo/dubbo-demo-xml/dubbo-demo-spring-mvc-rest-consumer/pom.xml b/dubbo-demo/dubbo-demo-xml/dubbo-demo-spring-mvc-rest-consumer/pom.xml
index dc750c333de..e0c96b82fe2 100644
--- a/dubbo-demo/dubbo-demo-xml/dubbo-demo-spring-mvc-rest-consumer/pom.xml
+++ b/dubbo-demo/dubbo-demo-xml/dubbo-demo-spring-mvc-rest-consumer/pom.xml
@@ -88,11 +88,6 @@
dubbo-rpc-dubbo${project.version}
-
- org.apache.dubbo
- dubbo-rpc-rest
- ${project.version}
- org.apache.dubbodubbo-config-spring
diff --git a/dubbo-demo/dubbo-demo-xml/dubbo-demo-spring-mvc-rest-provider/pom.xml b/dubbo-demo/dubbo-demo-xml/dubbo-demo-spring-mvc-rest-provider/pom.xml
index 80d5cc72be9..b9320cc5040 100644
--- a/dubbo-demo/dubbo-demo-xml/dubbo-demo-spring-mvc-rest-provider/pom.xml
+++ b/dubbo-demo/dubbo-demo-xml/dubbo-demo-spring-mvc-rest-provider/pom.xml
@@ -88,11 +88,6 @@
dubbo-rpc-dubbo${project.version}
-
- org.apache.dubbo
- dubbo-rpc-rest
- ${project.version}
- org.apache.dubbodubbo-config-spring
diff --git a/dubbo-demo/dubbo-demo-xml/dubbo-demo-xml-provider/pom.xml b/dubbo-demo/dubbo-demo-xml/dubbo-demo-xml-provider/pom.xml
index b3402d30bc0..16a2a5a6a07 100644
--- a/dubbo-demo/dubbo-demo-xml/dubbo-demo-xml-provider/pom.xml
+++ b/dubbo-demo/dubbo-demo-xml/dubbo-demo-xml-provider/pom.xml
@@ -82,11 +82,6 @@
dubbo-rpc-dubbo${project.version}
-
- org.apache.dubbo
- dubbo-rpc-rest
- ${project.version}
- org.apache.dubbodubbo-config-spring
diff --git a/dubbo-demo/dubbo-demo-xml/pom.xml b/dubbo-demo/dubbo-demo-xml/pom.xml
index 4a061ac4e8b..960f93e9e59 100644
--- a/dubbo-demo/dubbo-demo-xml/pom.xml
+++ b/dubbo-demo/dubbo-demo-xml/pom.xml
@@ -32,8 +32,6 @@
dubbo-demo-xml-providerdubbo-demo-xml-consumer
- dubbo-demo-jaxrs-rest-consumer
- dubbo-demo-jaxrs-rest-providerdubbo-demo-spring-mvc-rest-consumerdubbo-demo-spring-mvc-rest-provider
diff --git a/dubbo-distribution/dubbo-all-shaded/pom.xml b/dubbo-distribution/dubbo-all-shaded/pom.xml
index b0591156921..a27f148cef6 100644
--- a/dubbo-distribution/dubbo-all-shaded/pom.xml
+++ b/dubbo-distribution/dubbo-all-shaded/pom.xml
@@ -363,13 +363,6 @@
compiletrue
-
- org.apache.dubbo
- dubbo-rpc-rest
- ${project.version}
- compile
- true
- org.apache.dubbo
@@ -507,7 +500,6 @@
org.apache.dubbo:dubbo-rpc-apiorg.apache.dubbo:dubbo-rpc-dubboorg.apache.dubbo:dubbo-rpc-injvm
- org.apache.dubbo:dubbo-rpc-restorg.apache.dubbo:dubbo-rpc-tripleorg.apache.dubbo:dubbo-rest-jaxrsorg.apache.dubbo:dubbo-rest-servlet
@@ -631,24 +623,12 @@
META-INF/dubbo/internal/org.apache.dubbo.metadata.annotation.processing.builder.TypeBuilder
-
- META-INF/dubbo/internal/org.apache.dubbo.metadata.annotation.processing.rest.AnnotatedMethodParameterProcessor
-
-
- META-INF/dubbo/internal/org.apache.dubbo.metadata.annotation.processing.rest.ServiceRestMetadataResolver
- META-INF/dubbo/internal/org.apache.dubbo.metadata.definition.builder.TypeBuilderMETA-INF/dubbo/internal/org.apache.dubbo.metadata.report.MetadataReportFactory
-
- META-INF/dubbo/internal/org.apache.dubbo.metadata.rest.AnnotatedMethodParameterProcessor
-
-
- META-INF/dubbo/internal/org.apache.dubbo.metadata.rest.ServiceRestMetadataReader
- META-INF/dubbo/internal/org.apache.dubbo.monitor.MonitorFactory
@@ -708,30 +688,6 @@
META-INF/dubbo/internal/org.apache.dubbo.registry.integration.RegistryProtocolListener
-
- META-INF/dubbo/internal/org.apache.dubbo.rpc.protocol.rest.filter.RestResponseInterceptor
-
-
- META-INF/dubbo/internal/org.apache.dubbo.rpc.protocol.rest.filter.RestRequestFilter
-
-
- META-INF/dubbo/internal/org.apache.dubbo.rpc.protocol.rest.filter.RestResponseFilter
-
-
- META-INF/dubbo/internal/org.apache.dubbo.metadata.rest.NoAnnotatedParameterRequestTagProcessor
-
-
- META-INF/dubbo/internal/org.apache.dubbo.rpc.protocol.rest.message.HttpMessageCodec
-
-
- META-INF/dubbo/internal/org.apache.dubbo.rpc.protocol.rest.annotation.consumer.HttpConnectionPreBuildIntercept
-
-
- META-INF/dubbo/internal/org.apache.dubbo.rpc.protocol.rest.annotation.param.parse.consumer.BaseConsumerParamParser
-
-
- META-INF/dubbo/internal/org.apache.dubbo.remoting.http.factory.RestClientFactory
- META-INF/dubbo/internal/org.apache.dubbo.remoting.ChannelHandler
@@ -762,9 +718,6 @@
META-INF/dubbo/internal/org.apache.dubbo.remoting.exchange.Exchanger
-
- META-INF/dubbo/internal/org.apache.dubbo.remoting.http.HttpBinder
- META-INF/dubbo/internal/org.apache.dubbo.remoting.http12.message.HttpMessageEncoderFactory
@@ -921,9 +874,6 @@
META-INF/dubbo/internal/org.apache.dubbo.rpc.cluster.router.mesh.util.TracingContextProvider
-
- META-INF/dubbo/internal/org.apache.dubbo.metadata.rest.ServiceRestMetadataResolver
- META-INF/dubbo/internal/org.apache.dubbo.rpc.executor.IsolationExecutorSupportFactory
@@ -935,10 +885,6 @@
META-INF/dubbo/internal/org.apache.dubbo.spring.security.jackson.ObjectMapperCodecCustomer
-
- META-INF/dubbo/internal/org.apache.dubbo.rpc.protocol.rest.annotation.param.parse.provider.BaseProviderParamParser
-
-
META-INF/dubbo/internal/org.apache.dubbo.rpc.model.PackableMethodFactory
diff --git a/dubbo-distribution/dubbo-all/pom.xml b/dubbo-distribution/dubbo-all/pom.xml
index 19fd7dbbfc3..efe16c5cbf4 100644
--- a/dubbo-distribution/dubbo-all/pom.xml
+++ b/dubbo-distribution/dubbo-all/pom.xml
@@ -128,13 +128,6 @@
compiletrue
-
- org.apache.dubbo
- dubbo-metadata-rest
- ${project.version}
- compile
- true
- org.apache.dubbodubbo-metadata-report-zookeeper
@@ -343,13 +336,6 @@
compiletrue
-
- org.apache.dubbo
- dubbo-remoting-http
- ${project.version}
- compile
- true
- org.apache.dubbodubbo-remoting-http12
@@ -415,13 +401,6 @@
compiletrue
-
- org.apache.dubbo
- dubbo-rpc-rest
- ${project.version}
- compile
- true
- org.apache.dubbo
@@ -528,7 +507,6 @@
org.apache.dubbo:dubbo-filter-cacheorg.apache.dubbo:dubbo-filter-validationorg.apache.dubbo:dubbo-metadata-api
- org.apache.dubbo:dubbo-metadata-restorg.apache.dubbo:dubbo-metadata-definition-protobuforg.apache.dubbo:dubbo-metadata-report-nacosorg.apache.dubbo:dubbo-metadata-report-redis
@@ -553,7 +531,6 @@
org.apache.dubbo:dubbo-registry-nacosorg.apache.dubbo:dubbo-registry-zookeeperorg.apache.dubbo:dubbo-remoting-api
- org.apache.dubbo:dubbo-remoting-httporg.apache.dubbo:dubbo-remoting-http12org.apache.dubbo:dubbo-remoting-netty4org.apache.dubbo:dubbo-remoting-netty
@@ -563,7 +540,6 @@
org.apache.dubbo:dubbo-rpc-apiorg.apache.dubbo:dubbo-rpc-dubboorg.apache.dubbo:dubbo-rpc-injvm
- org.apache.dubbo:dubbo-rpc-restorg.apache.dubbo:dubbo-rpc-tripleorg.apache.dubbo:dubbo-rest-jaxrsorg.apache.dubbo:dubbo-rest-servlet
@@ -686,24 +662,12 @@
META-INF/dubbo/internal/org.apache.dubbo.metadata.annotation.processing.builder.TypeBuilder
-
- META-INF/dubbo/internal/org.apache.dubbo.metadata.annotation.processing.rest.AnnotatedMethodParameterProcessor
-
-
- META-INF/dubbo/internal/org.apache.dubbo.metadata.annotation.processing.rest.ServiceRestMetadataResolver
- META-INF/dubbo/internal/org.apache.dubbo.metadata.definition.builder.TypeBuilderMETA-INF/dubbo/internal/org.apache.dubbo.metadata.report.MetadataReportFactory
-
- META-INF/dubbo/internal/org.apache.dubbo.metadata.rest.AnnotatedMethodParameterProcessor
-
-
- META-INF/dubbo/internal/org.apache.dubbo.metadata.rest.ServiceRestMetadataReader
- META-INF/dubbo/internal/org.apache.dubbo.monitor.MonitorFactory
@@ -763,30 +727,6 @@
META-INF/dubbo/internal/org.apache.dubbo.registry.integration.RegistryProtocolListener
-
- META-INF/dubbo/internal/org.apache.dubbo.rpc.protocol.rest.filter.RestResponseInterceptor
-
-
- META-INF/dubbo/internal/org.apache.dubbo.rpc.protocol.rest.filter.RestRequestFilter
-
-
- META-INF/dubbo/internal/org.apache.dubbo.rpc.protocol.rest.filter.RestResponseFilter
-
-
- META-INF/dubbo/internal/org.apache.dubbo.metadata.rest.NoAnnotatedParameterRequestTagProcessor
-
-
- META-INF/dubbo/internal/org.apache.dubbo.rpc.protocol.rest.message.HttpMessageCodec
-
-
- META-INF/dubbo/internal/org.apache.dubbo.rpc.protocol.rest.annotation.consumer.HttpConnectionPreBuildIntercept
-
-
- META-INF/dubbo/internal/org.apache.dubbo.rpc.protocol.rest.annotation.param.parse.consumer.BaseConsumerParamParser
-
-
- META-INF/dubbo/internal/org.apache.dubbo.remoting.http.factory.RestClientFactory
- META-INF/dubbo/internal/org.apache.dubbo.remoting.ChannelHandler
@@ -817,9 +757,6 @@
META-INF/dubbo/internal/org.apache.dubbo.remoting.exchange.Exchanger
-
- META-INF/dubbo/internal/org.apache.dubbo.remoting.http.HttpBinder
- META-INF/dubbo/internal/org.apache.dubbo.remoting.http12.message.HttpMessageEncoderFactory
@@ -976,9 +913,6 @@
META-INF/dubbo/internal/org.apache.dubbo.rpc.cluster.router.mesh.util.TracingContextProvider
-
- META-INF/dubbo/internal/org.apache.dubbo.metadata.rest.ServiceRestMetadataResolver
- META-INF/dubbo/internal/org.apache.dubbo.rpc.executor.IsolationExecutorSupportFactory
@@ -990,10 +924,6 @@
META-INF/dubbo/internal/org.apache.dubbo.spring.security.jackson.ObjectMapperCodecCustomer
-
- META-INF/dubbo/internal/org.apache.dubbo.rpc.protocol.rest.annotation.param.parse.provider.BaseProviderParamParser
-
-
META-INF/dubbo/internal/org.apache.dubbo.rpc.model.PackableMethodFactory
diff --git a/dubbo-distribution/dubbo-core-spi/pom.xml b/dubbo-distribution/dubbo-core-spi/pom.xml
index 6ef9c5d928e..cdcd0bc429b 100644
--- a/dubbo-distribution/dubbo-core-spi/pom.xml
+++ b/dubbo-distribution/dubbo-core-spi/pom.xml
@@ -247,24 +247,12 @@
META-INF/dubbo/internal/org.apache.dubbo.metadata.annotation.processing.builder.TypeBuilder
-
- META-INF/dubbo/internal/org.apache.dubbo.metadata.annotation.processing.rest.AnnotatedMethodParameterProcessor
-
-
- META-INF/dubbo/internal/org.apache.dubbo.metadata.annotation.processing.rest.ServiceRestMetadataResolver
- META-INF/dubbo/internal/org.apache.dubbo.metadata.definition.builder.TypeBuilderMETA-INF/dubbo/internal/org.apache.dubbo.metadata.report.MetadataReportFactory
-
- META-INF/dubbo/internal/org.apache.dubbo.metadata.rest.AnnotatedMethodParameterProcessor
-
-
- META-INF/dubbo/internal/org.apache.dubbo.metadata.rest.ServiceRestMetadataReader
- META-INF/dubbo/internal/org.apache.dubbo.monitor.MonitorFactory
@@ -324,30 +312,6 @@
META-INF/dubbo/internal/org.apache.dubbo.registry.integration.RegistryProtocolListener
-
- META-INF/dubbo/internal/org.apache.dubbo.rpc.protocol.rest.filter.RestResponseInterceptor
-
-
- META-INF/dubbo/internal/org.apache.dubbo.rpc.protocol.rest.filter.RestRequestFilter
-
-
- META-INF/dubbo/internal/org.apache.dubbo.rpc.protocol.rest.filter.RestResponseFilter
-
-
- META-INF/dubbo/internal/org.apache.dubbo.metadata.rest.NoAnnotatedParameterRequestTagProcessor
-
-
- META-INF/dubbo/internal/org.apache.dubbo.rpc.protocol.rest.message.HttpMessageCodec
-
-
- META-INF/dubbo/internal/org.apache.dubbo.rpc.protocol.rest.annotation.consumer.HttpConnectionPreBuildIntercept
-
-
- META-INF/dubbo/internal/org.apache.dubbo.rpc.protocol.rest.annotation.param.parse.consumer.BaseConsumerParamParser
-
-
- META-INF/dubbo/internal/org.apache.dubbo.remoting.http.factory.RestClientFactory
- META-INF/dubbo/internal/org.apache.dubbo.remoting.ChannelHandler
@@ -378,9 +342,6 @@
META-INF/dubbo/internal/org.apache.dubbo.remoting.exchange.Exchanger
-
- META-INF/dubbo/internal/org.apache.dubbo.remoting.http.HttpBinder
- META-INF/dubbo/internal/org.apache.dubbo.remoting.http12.message.HttpMessageEncoderFactory
@@ -537,9 +498,6 @@
META-INF/dubbo/internal/org.apache.dubbo.rpc.cluster.router.mesh.util.TracingContextProvider
-
- META-INF/dubbo/internal/org.apache.dubbo.metadata.rest.ServiceRestMetadataResolver
- META-INF/dubbo/internal/org.apache.dubbo.rpc.executor.IsolationExecutorSupportFactory
@@ -551,10 +509,6 @@
META-INF/dubbo/internal/org.apache.dubbo.spring.security.jackson.ObjectMapperCodecCustomer
-
- META-INF/dubbo/internal/org.apache.dubbo.rpc.protocol.rest.annotation.param.parse.provider.BaseProviderParamParser
-
-
META-INF/dubbo/internal/org.apache.dubbo.rpc.model.PackableMethodFactory
diff --git a/dubbo-metadata/dubbo-metadata-processor/pom.xml b/dubbo-metadata/dubbo-metadata-processor/pom.xml
index fe6041612b2..bf8b63c8dbf 100644
--- a/dubbo-metadata/dubbo-metadata-processor/pom.xml
+++ b/dubbo-metadata/dubbo-metadata-processor/pom.xml
@@ -30,21 +30,6 @@
The metadata processor module of Dubbo project
-
- org.apache.dubbo
- dubbo-metadata-rest
- ${project.parent.version}
-
-
- org.apache.dubbo
- dubbo-rpc-api
-
-
- org.apache.dubbo
- dubbo-cluster
-
-
- org.apache.dubbo
@@ -77,10 +62,6 @@
-
- org.apache.dubbo
- dubbo-metadata-api
- org.apache.dubbodubbo-remoting-api
diff --git a/dubbo-metadata/dubbo-metadata-processor/src/main/java/org/apache/dubbo/metadata/annotation/processing/rest/AbstractAnnotatedMethodParameterProcessor.java b/dubbo-metadata/dubbo-metadata-processor/src/main/java/org/apache/dubbo/metadata/annotation/processing/rest/AbstractAnnotatedMethodParameterProcessor.java
deleted file mode 100644
index 142429e0f3d..00000000000
--- a/dubbo-metadata/dubbo-metadata-processor/src/main/java/org/apache/dubbo/metadata/annotation/processing/rest/AbstractAnnotatedMethodParameterProcessor.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * 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.annotation.processing.rest;
-
-import org.apache.dubbo.metadata.rest.RestMethodMetadata;
-
-import javax.lang.model.element.AnnotationMirror;
-import javax.lang.model.element.ExecutableElement;
-import javax.lang.model.element.VariableElement;
-
-import static org.apache.dubbo.metadata.annotation.processing.rest.AnnotatedMethodParameterProcessor.buildDefaultValue;
-import static org.apache.dubbo.metadata.annotation.processing.util.AnnotationUtils.getValue;
-
-/**
- * The abstract {@link AnnotatedMethodParameterProcessor} implementation
- *
- * @since 2.7.6
- */
-public abstract class AbstractAnnotatedMethodParameterProcessor implements AnnotatedMethodParameterProcessor {
-
- @Override
- public final void process(
- AnnotationMirror annotation,
- VariableElement parameter,
- int parameterIndex,
- ExecutableElement method,
- RestMethodMetadata restMethodMetadata) {
- String annotationValue = getAnnotationValue(annotation, parameter, parameterIndex);
- String defaultValue = getDefaultValue(annotation, parameter, parameterIndex);
- process(annotationValue, defaultValue, annotation, parameter, parameterIndex, method, restMethodMetadata);
- }
-
- protected abstract void process(
- String annotationValue,
- String defaultValue,
- AnnotationMirror annotation,
- VariableElement parameter,
- int parameterIndex,
- ExecutableElement method,
- RestMethodMetadata restMethodMetadata);
-
- protected String getAnnotationValue(AnnotationMirror annotation, VariableElement parameter, int parameterIndex) {
- return getValue(annotation);
- }
-
- protected String getDefaultValue(AnnotationMirror annotation, VariableElement parameter, int parameterIndex) {
- return buildDefaultValue(parameterIndex);
- }
-}
diff --git a/dubbo-metadata/dubbo-metadata-processor/src/main/java/org/apache/dubbo/metadata/annotation/processing/rest/AbstractServiceRestMetadataResolver.java b/dubbo-metadata/dubbo-metadata-processor/src/main/java/org/apache/dubbo/metadata/annotation/processing/rest/AbstractServiceRestMetadataResolver.java
deleted file mode 100644
index a2a388d34da..00000000000
--- a/dubbo-metadata/dubbo-metadata-processor/src/main/java/org/apache/dubbo/metadata/annotation/processing/rest/AbstractServiceRestMetadataResolver.java
+++ /dev/null
@@ -1,317 +0,0 @@
-/*
- * 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.annotation.processing.rest;
-
-import org.apache.dubbo.metadata.annotation.processing.util.ExecutableElementComparator;
-import org.apache.dubbo.metadata.definition.model.MethodDefinition;
-import org.apache.dubbo.metadata.rest.RequestMetadata;
-import org.apache.dubbo.metadata.rest.RestMethodMetadata;
-import org.apache.dubbo.metadata.rest.ServiceRestMetadata;
-import org.apache.dubbo.rpc.model.ApplicationModel;
-
-import javax.annotation.processing.ProcessingEnvironment;
-import javax.lang.model.element.AnnotationMirror;
-import javax.lang.model.element.ExecutableElement;
-import javax.lang.model.element.TypeElement;
-import javax.lang.model.element.VariableElement;
-import javax.lang.model.util.Elements;
-
-import java.util.HashMap;
-import java.util.LinkedHashMap;
-import java.util.LinkedHashSet;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Optional;
-import java.util.Set;
-import java.util.function.Function;
-import java.util.stream.Collectors;
-
-import static java.lang.ThreadLocal.withInitial;
-import static java.util.Collections.emptyList;
-import static java.util.Collections.sort;
-import static java.util.Optional.empty;
-import static java.util.Optional.of;
-import static org.apache.dubbo.metadata.annotation.processing.builder.MethodDefinitionBuilder.build;
-import static org.apache.dubbo.metadata.annotation.processing.util.LoggerUtils.info;
-import static org.apache.dubbo.metadata.annotation.processing.util.MethodUtils.getOverrideMethod;
-import static org.apache.dubbo.metadata.annotation.processing.util.MethodUtils.getPublicNonStaticMethods;
-import static org.apache.dubbo.metadata.annotation.processing.util.ServiceAnnotationUtils.getAnnotation;
-import static org.apache.dubbo.metadata.annotation.processing.util.ServiceAnnotationUtils.getGroup;
-import static org.apache.dubbo.metadata.annotation.processing.util.ServiceAnnotationUtils.getVersion;
-import static org.apache.dubbo.metadata.annotation.processing.util.ServiceAnnotationUtils.resolveServiceInterfaceName;
-
-/**
- * Abstract {@link ServiceRestMetadataResolver} implementation
- *
- * @since 2.7.6
- */
-public abstract class AbstractServiceRestMetadataResolver implements ServiceRestMetadataResolver {
-
- private static final ThreadLocal
-
- org.apache.dubbo
- dubbo-rpc-rest
- ${project.version}
- test
-
-
- javax.validation
- validation-api
-
-
- io.swagger
- swagger-jaxrs
-
-
- io.swagger
- swagger-annotations
-
-
- org.eclipse.jetty
- jetty-servlet
-
-
- org.apache.tomcat.embed
- tomcat-embed-core
-
-
- org.eclipse.jetty
- jetty-server
-
-
- org.jboss.resteasy
- resteasy-client
-
-
-
diff --git a/dubbo-plugin/dubbo-rest-jaxrs/src/test/java/org/apache/dubbo/rpc/protocol/tri/rest/support/jaxrs/compatible/JaxrsRestProtocolTest.java b/dubbo-plugin/dubbo-rest-jaxrs/src/test/java/org/apache/dubbo/rpc/protocol/tri/rest/support/jaxrs/compatible/JaxrsRestProtocolTest.java
index 9caa0b6a93f..fa4b681843c 100644
--- a/dubbo-plugin/dubbo-rest-jaxrs/src/test/java/org/apache/dubbo/rpc/protocol/tri/rest/support/jaxrs/compatible/JaxrsRestProtocolTest.java
+++ b/dubbo-plugin/dubbo-rest-jaxrs/src/test/java/org/apache/dubbo/rpc/protocol/tri/rest/support/jaxrs/compatible/JaxrsRestProtocolTest.java
@@ -53,6 +53,7 @@
import org.jboss.resteasy.specimpl.MultivaluedMapImpl;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import static org.apache.dubbo.remoting.Constants.SERVER_KEY;
@@ -60,6 +61,7 @@
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
+@Disabled
class JaxrsRestProtocolTest {
private final Protocol tProtocol =
ApplicationModel.defaultModel().getExtensionLoader(Protocol.class).getExtension("tri");
diff --git a/dubbo-plugin/dubbo-rest-spring/pom.xml b/dubbo-plugin/dubbo-rest-spring/pom.xml
index 5366743d486..21b3d9c084c 100644
--- a/dubbo-plugin/dubbo-rest-spring/pom.xml
+++ b/dubbo-plugin/dubbo-rest-spring/pom.xml
@@ -71,45 +71,5 @@
jaxb-runtimetest
-
- org.apache.dubbo
- dubbo-rpc-rest
- ${project.version}
- test
-
-
- javax.validation
- validation-api
-
-
- io.swagger
- swagger-jaxrs
-
-
- io.swagger
- swagger-annotations
-
-
- org.eclipse.jetty
- jetty-servlet
-
-
- org.apache.tomcat.embed
- tomcat-embed-core
-
-
- org.apache.httpcomponents
- httpclient
-
-
- org.eclipse.jetty
- jetty-server
-
-
- org.jboss.resteasy
- resteasy-client
-
-
-
diff --git a/dubbo-plugin/dubbo-rest-spring/src/test/java/org/apache/dubbo/rpc/protocol/tri/rest/support/spring/compatible/SpringMvcRestProtocolTest.java b/dubbo-plugin/dubbo-rest-spring/src/test/java/org/apache/dubbo/rpc/protocol/tri/rest/support/spring/compatible/SpringMvcRestProtocolTest.java
index 6e124fe2ae8..b3b8107dc4b 100644
--- a/dubbo-plugin/dubbo-rest-spring/src/test/java/org/apache/dubbo/rpc/protocol/tri/rest/support/spring/compatible/SpringMvcRestProtocolTest.java
+++ b/dubbo-plugin/dubbo-rest-spring/src/test/java/org/apache/dubbo/rpc/protocol/tri/rest/support/spring/compatible/SpringMvcRestProtocolTest.java
@@ -36,6 +36,7 @@
import org.hamcrest.CoreMatchers;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.springframework.aop.framework.AdvisedSupport;
import org.springframework.aop.framework.AopProxy;
@@ -46,6 +47,7 @@
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
+@Disabled
public class SpringMvcRestProtocolTest {
private final Protocol tProtocol =
ApplicationModel.defaultModel().getExtensionLoader(Protocol.class).getExtension("tri");
diff --git a/dubbo-remoting/dubbo-remoting-http/pom.xml b/dubbo-remoting/dubbo-remoting-http/pom.xml
deleted file mode 100644
index 91834389bb3..00000000000
--- a/dubbo-remoting/dubbo-remoting-http/pom.xml
+++ /dev/null
@@ -1,85 +0,0 @@
-
-
-
- 4.0.0
-
- org.apache.dubbo
- dubbo-remoting
- ${revision}
- ../pom.xml
-
- dubbo-remoting-http
- jar
- ${project.artifactId}
- The http remoting module of dubbo project
-
- false
-
-
-
- org.apache.dubbo
- dubbo-common
- ${project.parent.version}
-
-
- org.apache.dubbo
- dubbo-remoting-api
- ${project.parent.version}
-
-
- org.eclipse.jetty
- jetty-server
-
-
- org.eclipse.jetty
- jetty-servlet
-
-
- org.apache.tomcat.embed
- tomcat-embed-core
-
-
- org.apache.httpcomponents
- fluent-hc
- 4.5.14
- test
-
-
- org.apache.logging.log4j
- log4j-slf4j-impl
- test
-
-
-
- com.squareup.okhttp3
- okhttp
-
-
-
- org.apache.dubbo
- dubbo-rpc-api
- ${project.parent.version}
-
-
-
- org.apache.httpcomponents
- httpclient
-
-
-
-
diff --git a/dubbo-remoting/dubbo-remoting-http/src/main/java/org/apache/dubbo/remoting/http/BaseRestClient.java b/dubbo-remoting/dubbo-remoting-http/src/main/java/org/apache/dubbo/remoting/http/BaseRestClient.java
deleted file mode 100644
index 23c78419ad6..00000000000
--- a/dubbo-remoting/dubbo-remoting-http/src/main/java/org/apache/dubbo/remoting/http/BaseRestClient.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * 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.remoting.http;
-
-import org.apache.dubbo.remoting.http.config.HttpClientConfig;
-
-public abstract class BaseRestClient implements RestClient {
-
- protected CLIENT client;
-
- protected HttpClientConfig clientConfig;
-
- public BaseRestClient(HttpClientConfig clientConfig) {
- this.clientConfig = clientConfig;
- client = createHttpClient(clientConfig);
- }
-
- protected abstract CLIENT createHttpClient(HttpClientConfig clientConfig);
-
- public HttpClientConfig getClientConfig() {
- return clientConfig;
- }
-
- public CLIENT getClient() {
- return client;
- }
-}
diff --git a/dubbo-remoting/dubbo-remoting-http/src/main/java/org/apache/dubbo/remoting/http/HttpBinder.java b/dubbo-remoting/dubbo-remoting-http/src/main/java/org/apache/dubbo/remoting/http/HttpBinder.java
deleted file mode 100644
index 26db36d92cf..00000000000
--- a/dubbo-remoting/dubbo-remoting-http/src/main/java/org/apache/dubbo/remoting/http/HttpBinder.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * 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.remoting.http;
-
-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;
-
-/**
- * HttpBinder
- */
-@SPI(value = "jetty", scope = ExtensionScope.FRAMEWORK)
-public interface HttpBinder {
-
- /**
- * bind the server.
- *
- * @param url server url.
- * @return server.
- */
- @Adaptive({Constants.SERVER_KEY})
- HttpServer bind(URL url, HttpHandler handler);
-}
diff --git a/dubbo-remoting/dubbo-remoting-http/src/main/java/org/apache/dubbo/remoting/http/HttpHandler.java b/dubbo-remoting/dubbo-remoting-http/src/main/java/org/apache/dubbo/remoting/http/HttpHandler.java
deleted file mode 100644
index 27085f67bc7..00000000000
--- a/dubbo-remoting/dubbo-remoting-http/src/main/java/org/apache/dubbo/remoting/http/HttpHandler.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * 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.remoting.http;
-
-import java.io.IOException;
-
-/**
- * http invocation handler.
- */
-public interface HttpHandler {
-
- /**
- * invoke.
- *
- * @param request request.
- * @param response response.
- * @throws IOException
- */
- void handle(REQUEST request, RESPONSE response) throws IOException;
-}
diff --git a/dubbo-remoting/dubbo-remoting-http/src/main/java/org/apache/dubbo/remoting/http/HttpServer.java b/dubbo-remoting/dubbo-remoting-http/src/main/java/org/apache/dubbo/remoting/http/HttpServer.java
deleted file mode 100644
index d85582eb76a..00000000000
--- a/dubbo-remoting/dubbo-remoting-http/src/main/java/org/apache/dubbo/remoting/http/HttpServer.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * 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.remoting.http;
-
-import org.apache.dubbo.common.Resetable;
-import org.apache.dubbo.common.URL;
-import org.apache.dubbo.remoting.RemotingServer;
-
-import java.net.InetSocketAddress;
-
-public interface HttpServer extends Resetable, RemotingServer {
-
- /**
- * get http handler.
- *
- * @return http handler.
- */
- HttpHandler getHttpHandler();
-
- /**
- * get url.
- *
- * @return url
- */
- URL getUrl();
-
- /**
- * get local address.
- *
- * @return local address.
- */
- InetSocketAddress getLocalAddress();
-
- /**
- * close the channel.
- */
- void close();
-
- /**
- * Graceful close the channel.
- */
- void close(int timeout);
-
- /**
- * is bound.
- *
- * @return bound
- */
- boolean isBound();
-
- /**
- * is closed.
- *
- * @return closed
- */
- boolean isClosed();
-}
diff --git a/dubbo-remoting/dubbo-remoting-http/src/main/java/org/apache/dubbo/remoting/http/RequestTemplate.java b/dubbo-remoting/dubbo-remoting-http/src/main/java/org/apache/dubbo/remoting/http/RequestTemplate.java
deleted file mode 100644
index 5536e6c83e6..00000000000
--- a/dubbo-remoting/dubbo-remoting-http/src/main/java/org/apache/dubbo/remoting/http/RequestTemplate.java
+++ /dev/null
@@ -1,299 +0,0 @@
-/*
- * 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.remoting.http;
-
-import org.apache.dubbo.remoting.Constants;
-import org.apache.dubbo.rpc.Invocation;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-
-public class RequestTemplate implements Serializable {
- private static final long serialVersionUID = 1L;
- public static final String CONTENT_ENCODING = "Content-Encoding";
- private static final String CONTENT_LENGTH = "Content-Length";
- public static final String ENCODING_GZIP = "gzip";
- public static final String ENCODING_DEFLATE = "deflate";
- private static final List EMPTY_ARRAYLIST = new ArrayList<>();
-
- private final Map> queries = new LinkedHashMap<>();
- private final Map> headers = new LinkedHashMap<>();
- private String httpMethod;
- private String path;
- private String address;
- private Object body;
- private byte[] byteBody = new byte[0];
- private String protocol = "http://";
- private final Invocation invocation;
- private String contextPath = "";
- private Class> bodyType;
-
- public RequestTemplate(Invocation invocation, String httpMethod, String address) {
- this(invocation, httpMethod, address, "");
- }
-
- public RequestTemplate(Invocation invocation, String httpMethod, String address, String contextPath) {
- this.httpMethod = httpMethod;
- this.address = address;
- this.invocation = invocation;
- this.contextPath = contextPath;
- }
-
- public String getURL() {
- StringBuilder stringBuilder = new StringBuilder(getProtocol() + address);
-
- stringBuilder.append(getUri());
- return stringBuilder.toString();
- }
-
- public String getUri() {
- StringBuilder stringBuilder = new StringBuilder(getContextPath() + path);
- return stringBuilder.append(getQueryString()).toString();
- }
-
- public String getQueryString() {
-
- if (queries.isEmpty()) {
- return "";
- }
-
- StringBuilder queryBuilder = new StringBuilder("?");
- for (String field : queries.keySet()) {
-
- Collection queryValues = queries.get(field);
-
- if (queryValues == null || queryValues.isEmpty()) {
- continue;
- }
-
- for (String value : queryValues) {
- queryBuilder.append('&');
- queryBuilder.append(field);
- if (value == null) {
- continue;
- }
-
- queryBuilder.append('=');
- queryBuilder.append(value);
- }
- }
-
- return queryBuilder.toString().replace("?&", "?");
- }
-
- public RequestTemplate path(String path) {
- this.path = path;
- return this;
- }
-
- public String getHttpMethod() {
- return httpMethod;
- }
-
- public RequestTemplate httpMethod(String httpMethod) {
- this.httpMethod = httpMethod;
- return this;
- }
-
- public byte[] getSerializedBody() {
- return byteBody;
- }
-
- public void serializeBody(byte[] body) {
- addHeader(CONTENT_LENGTH, body.length); // must header
- this.byteBody = body;
- }
-
- public boolean isBodyEmpty() {
- return getUnSerializedBody() == null;
- }
-
- public RequestTemplate body(Object body, Class bodyType) {
- this.body = body;
- setBodyType(bodyType);
- return this;
- }
-
- public Object getUnSerializedBody() {
- return body;
- }
-
- public Map> getAllHeaders() {
- return headers;
- }
-
- public Collection getHeaders(String name) {
- return headers.get(name);
- }
-
- public String getHeader(String name) {
- if (headers.containsKey(name)) {
-
- Collection headers = getHeaders(name);
-
- if (headers.isEmpty()) {
- return null;
- }
- String[] strings = headers.toArray(new String[0]);
- return strings[0];
-
- } else {
- return null;
- }
- }
-
- public Collection getEncodingValues() {
- if (headers.containsKey(CONTENT_ENCODING)) {
- return headers.get(CONTENT_ENCODING);
- }
- return EMPTY_ARRAYLIST;
- }
-
- public boolean isGzipEncodedRequest() {
- return getEncodingValues().contains(ENCODING_GZIP);
- }
-
- public boolean isDeflateEncodedRequest() {
- return getEncodingValues().contains(ENCODING_DEFLATE);
- }
-
- public void addHeader(String key, String value) {
- addValueByKey(key, value, this.headers);
- }
-
- public void addHeader(String key, Object value) {
- addValueByKey(key, String.valueOf(value), this.headers);
- }
-
- public void addKeepAliveHeader(int time) {
- addHeader(Constants.KEEP_ALIVE_HEADER, time);
- addHeader(Constants.CONNECTION, Constants.KEEP_ALIVE);
- }
-
- public void addHeaders(String key, Collection values) {
- Collection header = getHeaders(key);
-
- if (header == null) {
- header = new HashSet<>();
- this.headers.put(key, header);
- }
- header.addAll(values);
- }
-
- public void addParam(String key, String value) {
- addValueByKey(key, value, this.queries);
- }
-
- public void addParam(String key, Object value) {
- addParam(key, String.valueOf(value));
- }
-
- public Map> getQueries() {
- return queries;
- }
-
- public Collection getParam(String key) {
- return getQueries().get(key);
- }
-
- public void addParams(String key, Collection values) {
- Collection params = getParam(key);
-
- if (params == null) {
- params = new HashSet<>();
- this.queries.put(key, params);
- }
- params.addAll(values);
- }
-
- public void addValueByKey(String key, String value, Map> maps) {
-
- if (value == null) {
- return;
- }
-
- Collection values = null;
- if (!maps.containsKey(key)) {
- values = new HashSet<>();
- maps.put(key, values);
- }
- values = maps.get(key);
-
- values.add(value);
- }
-
- public Integer getContentLength() {
-
- if (!getAllHeaders().containsKey(CONTENT_LENGTH)) {
- return null;
- }
-
- HashSet strings = (HashSet) getAllHeaders().get(CONTENT_LENGTH);
-
- return Integer.parseInt(new ArrayList<>(strings).get(0));
- }
-
- public String getAddress() {
- return address;
- }
-
- public void setAddress(String address) {
- addHeader("Host", address); // must header
- this.address = address;
- }
-
- public String getProtocol() {
- return protocol;
- }
-
- public void setProtocol(String protocol) {
- this.protocol = protocol;
- }
-
- public Invocation getInvocation() {
- return invocation;
- }
-
- public String getContextPath() {
- if (contextPath == null || contextPath.length() == 0) {
- return "";
- }
-
- if (contextPath.startsWith("/")) {
- return contextPath;
- } else {
- return "/" + contextPath;
- }
- }
-
- public void setContextPath(String contextPath) {
- this.contextPath = contextPath;
- }
-
- public Class> getBodyType() {
- return bodyType;
- }
-
- public void setBodyType(Class> bodyType) {
- this.bodyType = bodyType;
- }
-}
diff --git a/dubbo-remoting/dubbo-remoting-http/src/main/java/org/apache/dubbo/remoting/http/RestClient.java b/dubbo-remoting/dubbo-remoting-http/src/main/java/org/apache/dubbo/remoting/http/RestClient.java
deleted file mode 100644
index e5b8cecf7df..00000000000
--- a/dubbo-remoting/dubbo-remoting-http/src/main/java/org/apache/dubbo/remoting/http/RestClient.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * 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.remoting.http;
-
-import org.apache.dubbo.remoting.RemotingException;
-
-import java.util.concurrent.CompletableFuture;
-
-public interface RestClient {
- /**
- * send message.
- *
- * @param message
- * @throws RemotingException
- */
- CompletableFuture send(RequestTemplate message);
-
- /**
- * close the channel.
- */
- void close();
-
- /**
- * Graceful close the channel.
- */
- void close(int timeout);
-
- /**
- * is closed.
- *
- * @return closed
- */
- boolean isClosed();
-}
diff --git a/dubbo-remoting/dubbo-remoting-http/src/main/java/org/apache/dubbo/remoting/http/RestResult.java b/dubbo-remoting/dubbo-remoting-http/src/main/java/org/apache/dubbo/remoting/http/RestResult.java
deleted file mode 100644
index bb057675dfe..00000000000
--- a/dubbo-remoting/dubbo-remoting-http/src/main/java/org/apache/dubbo/remoting/http/RestResult.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * 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.remoting.http;
-
-import java.io.IOException;
-import java.util.List;
-import java.util.Map;
-
-/**
- * rest response facade
- */
-public interface RestResult {
- String getContentType();
-
- byte[] getBody() throws IOException;
-
- Map> headers();
-
- byte[] getErrorResponse() throws IOException;
-
- int getResponseCode() throws IOException;
-
- String getMessage() throws IOException;
-
- default String appendErrorMessage(String message, String errorInfo) {
- return message + "\n error info is: " + errorInfo;
- }
-}
diff --git a/dubbo-remoting/dubbo-remoting-http/src/main/java/org/apache/dubbo/remoting/http/config/HttpClientConfig.java b/dubbo-remoting/dubbo-remoting-http/src/main/java/org/apache/dubbo/remoting/http/config/HttpClientConfig.java
deleted file mode 100644
index fa7cb5ab3ab..00000000000
--- a/dubbo-remoting/dubbo-remoting-http/src/main/java/org/apache/dubbo/remoting/http/config/HttpClientConfig.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * 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.remoting.http.config;
-
-public class HttpClientConfig {
- private int readTimeout = 6 * 1000;
- private int writeTimeout = 6 * 1000;
- private int connectTimeout = 6 * 1000;
- private int chunkLength = 8196;
-
- private int maxIdleConnections = 20;
-
- private int keepAliveDuration = 30 * 1000;
-
- private int HTTP_CLIENT_CONNECTION_MANAGER_MAX_PER_ROUTE = 20;
- private int HTTP_CLIENT_CONNECTION_MANAGER_MAX_TOTAL = 20;
- private int HTTPCLIENT_KEEP_ALIVE_DURATION = 30 * 1000;
- private int HTTP_CLIENT_CONNECTION_MANAGER_CLOSE_WAIT_TIME_MS = 1000;
- private int HTTP_CLIENT_CONNECTION_MANAGER_CLOSE_IDLE_TIME_S = 30;
-
- public HttpClientConfig() {}
-
- public int getReadTimeout() {
- return readTimeout;
- }
-
- public void setReadTimeout(int readTimeout) {
- this.readTimeout = readTimeout;
- }
-
- public int getWriteTimeout() {
- return writeTimeout;
- }
-
- public void setWriteTimeout(int writeTimeout) {
- this.writeTimeout = writeTimeout;
- }
-
- public int getConnectTimeout() {
- return connectTimeout;
- }
-
- public void setConnectTimeout(int connectTimeout) {
- this.connectTimeout = connectTimeout;
- }
-
- public int getChunkLength() {
- return chunkLength;
- }
-
- public int getMaxIdleConnections() {
-
- return maxIdleConnections;
- }
-
- public void setMaxIdleConnections(int maxIdleConnections) {
-
- this.maxIdleConnections = maxIdleConnections;
- }
-
- public int getKeepAliveDuration() {
-
- return keepAliveDuration;
- }
-
- public void setKeepAliveDuration(int keepAliveDuration) {
-
- this.keepAliveDuration = keepAliveDuration;
- }
-}
diff --git a/dubbo-remoting/dubbo-remoting-http/src/main/java/org/apache/dubbo/remoting/http/factory/AbstractHttpClientFactory.java b/dubbo-remoting/dubbo-remoting-http/src/main/java/org/apache/dubbo/remoting/http/factory/AbstractHttpClientFactory.java
deleted file mode 100644
index ad9e7f7821f..00000000000
--- a/dubbo-remoting/dubbo-remoting-http/src/main/java/org/apache/dubbo/remoting/http/factory/AbstractHttpClientFactory.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * 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.remoting.http.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 {
-
- protected final ErrorTypeAwareLogger logger = LoggerFactory.getErrorTypeAwareLogger(getClass());
-
- // TODO load config
- protected HttpClientConfig httpClientConfig = new HttpClientConfig();
-
- //////////////////////////////////////// implements start ///////////////////////////////////////////////
- @Override
- public RestClient createRestClient(URL url) throws RpcException {
-
- beforeCreated(url);
-
- // create a raw client
- RestClient restClient = doCreateRestClient(url);
-
- // postprocessor
- afterCreated(restClient);
-
- return restClient;
- }
-
- //////////////////////////////////////// implements end ///////////////////////////////////////////////
-
- //////////////////////////////////////// inner methods ///////////////////////////////////////////////
-
- protected void beforeCreated(URL url) {}
-
- protected abstract RestClient doCreateRestClient(URL url) throws RpcException;
-
- protected void afterCreated(RestClient client) {}
-
- //////////////////////////////////////// inner methods ///////////////////////////////////////////////
-
-}
diff --git a/dubbo-remoting/dubbo-remoting-http/src/main/java/org/apache/dubbo/remoting/http/factory/RestClientFactory.java b/dubbo-remoting/dubbo-remoting-http/src/main/java/org/apache/dubbo/remoting/http/factory/RestClientFactory.java
deleted file mode 100644
index c64453dbda9..00000000000
--- a/dubbo-remoting/dubbo-remoting-http/src/main/java/org/apache/dubbo/remoting/http/factory/RestClientFactory.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * 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.remoting.http.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 = Constants.OK_HTTP, scope = ExtensionScope.FRAMEWORK)
-public interface RestClientFactory {
-
- @Adaptive({Constants.CLIENT_KEY})
- RestClient createRestClient(URL url) throws RpcException;
-}
diff --git a/dubbo-remoting/dubbo-remoting-http/src/main/java/org/apache/dubbo/remoting/http/factory/impl/ApacheHttpClientFactory.java b/dubbo-remoting/dubbo-remoting-http/src/main/java/org/apache/dubbo/remoting/http/factory/impl/ApacheHttpClientFactory.java
deleted file mode 100644
index 89d9c36f6fb..00000000000
--- a/dubbo-remoting/dubbo-remoting-http/src/main/java/org/apache/dubbo/remoting/http/factory/impl/ApacheHttpClientFactory.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * 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.remoting.http.factory.impl;
-
-import org.apache.dubbo.common.URL;
-import org.apache.dubbo.common.extension.Activate;
-import org.apache.dubbo.remoting.Constants;
-import org.apache.dubbo.remoting.http.RestClient;
-import org.apache.dubbo.remoting.http.factory.AbstractHttpClientFactory;
-import org.apache.dubbo.remoting.http.restclient.HttpClientRestClient;
-import org.apache.dubbo.rpc.RpcException;
-
-@Activate(Constants.APACHE_HTTP_CLIENT)
-public class ApacheHttpClientFactory extends AbstractHttpClientFactory {
-
- @Override
- protected RestClient doCreateRestClient(URL url) throws RpcException {
-
- return new HttpClientRestClient(httpClientConfig);
- }
-}
diff --git a/dubbo-remoting/dubbo-remoting-http/src/main/java/org/apache/dubbo/remoting/http/factory/impl/OkHttpClientFactory.java b/dubbo-remoting/dubbo-remoting-http/src/main/java/org/apache/dubbo/remoting/http/factory/impl/OkHttpClientFactory.java
deleted file mode 100644
index 523df3caf89..00000000000
--- a/dubbo-remoting/dubbo-remoting-http/src/main/java/org/apache/dubbo/remoting/http/factory/impl/OkHttpClientFactory.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * 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.remoting.http.factory.impl;
-
-import org.apache.dubbo.common.URL;
-import org.apache.dubbo.common.extension.Activate;
-import org.apache.dubbo.remoting.Constants;
-import org.apache.dubbo.remoting.http.RestClient;
-import org.apache.dubbo.remoting.http.factory.AbstractHttpClientFactory;
-import org.apache.dubbo.remoting.http.restclient.OKHttpRestClient;
-import org.apache.dubbo.rpc.RpcException;
-
-@Activate(Constants.OK_HTTP)
-public class OkHttpClientFactory extends AbstractHttpClientFactory {
-
- @Override
- protected RestClient doCreateRestClient(URL url) throws RpcException {
-
- return new OKHttpRestClient(httpClientConfig);
- }
-}
diff --git a/dubbo-remoting/dubbo-remoting-http/src/main/java/org/apache/dubbo/remoting/http/factory/impl/URLConnectionClientFactory.java b/dubbo-remoting/dubbo-remoting-http/src/main/java/org/apache/dubbo/remoting/http/factory/impl/URLConnectionClientFactory.java
deleted file mode 100644
index 40c2a82a66a..00000000000
--- a/dubbo-remoting/dubbo-remoting-http/src/main/java/org/apache/dubbo/remoting/http/factory/impl/URLConnectionClientFactory.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * 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.remoting.http.factory.impl;
-
-import org.apache.dubbo.common.URL;
-import org.apache.dubbo.common.extension.Activate;
-import org.apache.dubbo.remoting.Constants;
-import org.apache.dubbo.remoting.http.RestClient;
-import org.apache.dubbo.remoting.http.factory.AbstractHttpClientFactory;
-import org.apache.dubbo.remoting.http.restclient.URLConnectionRestClient;
-import org.apache.dubbo.rpc.RpcException;
-
-@Activate(Constants.URL_CONNECTION)
-public class URLConnectionClientFactory extends AbstractHttpClientFactory {
-
- @Override
- protected RestClient doCreateRestClient(URL url) throws RpcException {
-
- return new URLConnectionRestClient(httpClientConfig);
- }
-}
diff --git a/dubbo-remoting/dubbo-remoting-http/src/main/java/org/apache/dubbo/remoting/http/jetty/JettyHttpBinder.java b/dubbo-remoting/dubbo-remoting-http/src/main/java/org/apache/dubbo/remoting/http/jetty/JettyHttpBinder.java
deleted file mode 100644
index 05e5dc5a354..00000000000
--- a/dubbo-remoting/dubbo-remoting-http/src/main/java/org/apache/dubbo/remoting/http/jetty/JettyHttpBinder.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * 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.remoting.http.jetty;
-
-import org.apache.dubbo.common.URL;
-import org.apache.dubbo.remoting.http.HttpBinder;
-import org.apache.dubbo.remoting.http.HttpHandler;
-import org.apache.dubbo.remoting.http.HttpServer;
-
-/**
- * JettyHttpTransporter
- */
-public class JettyHttpBinder implements HttpBinder {
-
- @Override
- public HttpServer bind(URL url, HttpHandler handler) {
- return new JettyHttpServer(url, handler);
- }
-}
diff --git a/dubbo-remoting/dubbo-remoting-http/src/main/java/org/apache/dubbo/remoting/http/jetty/JettyHttpServer.java b/dubbo-remoting/dubbo-remoting-http/src/main/java/org/apache/dubbo/remoting/http/jetty/JettyHttpServer.java
deleted file mode 100644
index 0139a5d79ff..00000000000
--- a/dubbo-remoting/dubbo-remoting-http/src/main/java/org/apache/dubbo/remoting/http/jetty/JettyHttpServer.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * 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.remoting.http.jetty;
-
-import org.apache.dubbo.common.URL;
-import org.apache.dubbo.common.logger.ErrorTypeAwareLogger;
-import org.apache.dubbo.common.logger.LoggerFactory;
-import org.apache.dubbo.common.utils.NetUtils;
-import org.apache.dubbo.remoting.Constants;
-import org.apache.dubbo.remoting.http.HttpHandler;
-import org.apache.dubbo.remoting.http.servlet.DispatcherServlet;
-import org.apache.dubbo.remoting.http.servlet.ServletManager;
-import org.apache.dubbo.remoting.http.support.AbstractHttpServer;
-
-import org.eclipse.jetty.server.Server;
-import org.eclipse.jetty.server.ServerConnector;
-import org.eclipse.jetty.servlet.ServletContextHandler;
-import org.eclipse.jetty.servlet.ServletHandler;
-import org.eclipse.jetty.servlet.ServletHolder;
-import org.eclipse.jetty.util.thread.QueuedThreadPool;
-
-import static org.apache.dubbo.common.constants.CommonConstants.DEFAULT_THREADS;
-import static org.apache.dubbo.common.constants.CommonConstants.THREADS_KEY;
-import static org.apache.dubbo.common.constants.LoggerCodeConstants.COMMON_FAILED_STOP_HTTP_SERVER;
-
-public class JettyHttpServer extends AbstractHttpServer {
-
- private static final ErrorTypeAwareLogger logger = LoggerFactory.getErrorTypeAwareLogger(JettyHttpServer.class);
-
- private Server server;
-
- private URL url;
-
- public JettyHttpServer(URL url, final HttpHandler handler) {
- super(url, handler);
- this.url = url;
-
- // set dubbo's logger
- System.setProperty("org.eclipse.jetty.util.log.class", JettyLoggerAdapter.class.getName());
-
- DispatcherServlet.addHttpHandler(url.getParameter(Constants.BIND_PORT_KEY, url.getPort()), handler);
-
- int threads = url.getParameter(THREADS_KEY, DEFAULT_THREADS);
- QueuedThreadPool threadPool = new QueuedThreadPool();
- threadPool.setDaemon(true);
- threadPool.setMaxThreads(threads);
- threadPool.setMinThreads(threads);
-
- server = new Server(threadPool);
-
- ServerConnector connector = new ServerConnector(server);
-
- String bindIp = url.getParameter(Constants.BIND_IP_KEY, url.getHost());
- if (!url.isAnyHost() && NetUtils.isValidLocalHost(bindIp)) {
- connector.setHost(bindIp);
- }
- connector.setPort(url.getParameter(Constants.BIND_PORT_KEY, url.getPort()));
-
- server.addConnector(connector);
-
- ServletHandler servletHandler = new ServletHandler();
- ServletHolder servletHolder = servletHandler.addServletWithMapping(DispatcherServlet.class, "/*");
- servletHolder.setInitOrder(2);
-
- // dubbo's original impl can't support the use of ServletContext
- // server.addHandler(servletHandler);
- // TODO Context.SESSIONS is the best option here? (In jetty 9.x, it becomes ServletContextHandler.SESSIONS)
- ServletContextHandler context = new ServletContextHandler(server, "/", ServletContextHandler.SESSIONS);
- context.setServletHandler(servletHandler);
- ServletManager.getInstance()
- .addServletContext(
- url.getParameter(Constants.BIND_PORT_KEY, url.getPort()), context.getServletContext());
-
- try {
- server.start();
- } catch (Exception e) {
- throw new IllegalStateException(
- "Failed to start jetty server on " + url.getParameter(Constants.BIND_IP_KEY) + ":"
- + url.getParameter(Constants.BIND_PORT_KEY) + ", cause: " + e.getMessage(),
- e);
- }
- }
-
- @Override
- public void close() {
- super.close();
-
- //
- ServletManager.getInstance().removeServletContext(url.getParameter(Constants.BIND_PORT_KEY, url.getPort()));
-
- if (server != null) {
- try {
- server.stop();
- } catch (Exception e) {
- logger.warn(COMMON_FAILED_STOP_HTTP_SERVER, "", "", e.getMessage(), e);
- }
- }
- }
-}
diff --git a/dubbo-remoting/dubbo-remoting-http/src/main/java/org/apache/dubbo/remoting/http/jetty/JettyLoggerAdapter.java b/dubbo-remoting/dubbo-remoting-http/src/main/java/org/apache/dubbo/remoting/http/jetty/JettyLoggerAdapter.java
deleted file mode 100644
index b93cb3f2ce1..00000000000
--- a/dubbo-remoting/dubbo-remoting-http/src/main/java/org/apache/dubbo/remoting/http/jetty/JettyLoggerAdapter.java
+++ /dev/null
@@ -1,161 +0,0 @@
-/*
- * 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.remoting.http.jetty;
-
-import org.apache.dubbo.common.logger.ErrorTypeAwareLogger;
-import org.apache.dubbo.common.logger.LoggerFactory;
-
-import org.eclipse.jetty.util.log.AbstractLogger;
-import org.eclipse.jetty.util.log.Logger;
-
-import static org.apache.dubbo.common.constants.LoggerCodeConstants.COMMON_UNEXPECTED_EXCEPTION;
-
-/**
- * logger adapter for jetty
- */
-public class JettyLoggerAdapter extends AbstractLogger {
- protected String name;
-
- private final ErrorTypeAwareLogger logger;
-
- private static boolean debugEnabled = false;
-
- public JettyLoggerAdapter() {
- this("org.apache.dubbo.remoting.http.jetty");
- }
-
- public JettyLoggerAdapter(Class> clazz) {
- this(clazz.getName());
- }
-
- public JettyLoggerAdapter(String name) {
- this.name = name;
- this.logger = LoggerFactory.getErrorTypeAwareLogger(name);
- }
-
- @Override
- protected Logger newLogger(String name) {
- return new JettyLoggerAdapter(name);
- }
-
- @Override
- public String getName() {
- return this.name;
- }
-
- @Override
- public void warn(String msg, Object... objects) {
- if (logger.isWarnEnabled()) {
- logger.warn(COMMON_UNEXPECTED_EXCEPTION, "", "", this.format(msg, objects));
- }
- }
-
- @Override
- public void warn(Throwable throwable) {
- if (logger.isWarnEnabled()) {
- logger.warn(COMMON_UNEXPECTED_EXCEPTION, "", "", throwable.getMessage(), throwable);
- }
- }
-
- @Override
- public void warn(String msg, Throwable throwable) {
- if (logger.isWarnEnabled()) {
- logger.warn(COMMON_UNEXPECTED_EXCEPTION, "", "", msg, throwable);
- }
- }
-
- @Override
- public void info(String msg, Object... objects) {
- if (logger.isInfoEnabled()) {
- logger.info(this.format(msg, objects));
- }
- }
-
- @Override
- public void info(Throwable throwable) {
- if (logger.isInfoEnabled()) {
- logger.info(throwable);
- }
- }
-
- @Override
- public void info(String msg, Throwable throwable) {
- if (logger.isInfoEnabled()) {
- logger.info(msg, throwable);
- }
- }
-
- @Override
- public boolean isDebugEnabled() {
- return debugEnabled;
- }
-
- @Override
- public void setDebugEnabled(boolean enabled) {
- debugEnabled = enabled;
- }
-
- @Override
- public void debug(String msg, Object... objects) {
- if (debugEnabled && logger.isDebugEnabled()) {
- logger.debug(this.format(msg, objects));
- }
- }
-
- @Override
- public void debug(Throwable throwable) {
- if (debugEnabled && logger.isDebugEnabled()) {
- logger.debug(throwable);
- }
- }
-
- @Override
- public void debug(String msg, Throwable throwable) {
- if (debugEnabled && logger.isDebugEnabled()) {
- logger.debug(msg, throwable);
- }
- }
-
- @Override
- public void ignore(Throwable throwable) {
- if (logger.isWarnEnabled()) {
- logger.warn(COMMON_UNEXPECTED_EXCEPTION, "", "", "IGNORED EXCEPTION ", throwable);
- }
- }
-
- private String format(String msg, Object... args) {
- msg = String.valueOf(msg); // Avoids NPE
- String braces = "{}";
- StringBuilder builder = new StringBuilder();
- int start = 0;
- for (Object arg : args) {
- int bracesIndex = msg.indexOf(braces, start);
- if (bracesIndex < 0) {
- builder.append(msg.substring(start));
- builder.append(' ');
- builder.append(arg);
- start = msg.length();
- } else {
- builder.append(msg, start, bracesIndex);
- builder.append(arg);
- start = bracesIndex + braces.length();
- }
- }
- builder.append(msg.substring(start));
- return builder.toString();
- }
-}
diff --git a/dubbo-remoting/dubbo-remoting-http/src/main/java/org/apache/dubbo/remoting/http/restclient/HttpClientRestClient.java b/dubbo-remoting/dubbo-remoting-http/src/main/java/org/apache/dubbo/remoting/http/restclient/HttpClientRestClient.java
deleted file mode 100644
index f09b288c5f8..00000000000
--- a/dubbo-remoting/dubbo-remoting-http/src/main/java/org/apache/dubbo/remoting/http/restclient/HttpClientRestClient.java
+++ /dev/null
@@ -1,188 +0,0 @@
-/*
- * 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.remoting.http.restclient;
-
-import org.apache.dubbo.remoting.http.RequestTemplate;
-import org.apache.dubbo.remoting.http.RestClient;
-import org.apache.dubbo.remoting.http.RestResult;
-import org.apache.dubbo.remoting.http.config.HttpClientConfig;
-
-import java.io.IOException;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.CompletableFuture;
-import java.util.stream.Collectors;
-
-import org.apache.commons.io.IOUtils;
-import org.apache.http.Header;
-import org.apache.http.HttpEntityEnclosingRequest;
-import org.apache.http.client.config.RequestConfig;
-import org.apache.http.client.methods.CloseableHttpResponse;
-import org.apache.http.client.methods.HttpDelete;
-import org.apache.http.client.methods.HttpEntityEnclosingRequestBase;
-import org.apache.http.client.methods.HttpGet;
-import org.apache.http.client.methods.HttpHead;
-import org.apache.http.client.methods.HttpOptions;
-import org.apache.http.client.methods.HttpPatch;
-import org.apache.http.client.methods.HttpPost;
-import org.apache.http.client.methods.HttpPut;
-import org.apache.http.client.methods.HttpRequestBase;
-import org.apache.http.client.methods.HttpTrace;
-import org.apache.http.entity.ByteArrayEntity;
-import org.apache.http.impl.client.CloseableHttpClient;
-import org.apache.http.impl.client.HttpClients;
-import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
-
-public class HttpClientRestClient implements RestClient {
- private final CloseableHttpClient closeableHttpClient;
- private final HttpClientConfig httpClientConfig;
-
- public HttpClientRestClient(HttpClientConfig clientConfig) {
- closeableHttpClient = createHttpClient();
- httpClientConfig = clientConfig;
- }
-
- @Override
- public CompletableFuture send(RequestTemplate requestTemplate) {
-
- HttpRequestBase httpRequest = null;
- String httpMethod = requestTemplate.getHttpMethod();
-
- httpRequest = createHttpUriRequest(httpMethod, requestTemplate);
-
- if (httpRequest instanceof HttpEntityEnclosingRequest) {
- ((HttpEntityEnclosingRequestBase) httpRequest)
- .setEntity(new ByteArrayEntity(requestTemplate.getSerializedBody()));
- }
-
- Map> allHeaders = requestTemplate.getAllHeaders();
-
- allHeaders.remove("Content-Length");
- // header
- for (String headerName : allHeaders.keySet()) {
- Collection headerValues = allHeaders.get(headerName);
-
- for (String headerValue : headerValues) {
- httpRequest.addHeader(headerName, headerValue);
- }
- }
-
- httpRequest.setConfig(getRequestConfig(httpClientConfig));
-
- CompletableFuture future = new CompletableFuture<>();
- try {
- CloseableHttpResponse response = closeableHttpClient.execute(httpRequest);
- future.complete(new RestResult() {
- @Override
- public String getContentType() {
- Header header = response.getFirstHeader("Content-Type");
- return header == null ? null : header.getValue();
- }
-
- @Override
- public byte[] getBody() throws IOException {
- if (response.getEntity() == null) {
- return new byte[0];
- }
- return IOUtils.toByteArray(response.getEntity().getContent());
- }
-
- @Override
- public Map> headers() {
- return Arrays.stream(response.getAllHeaders())
- .collect(Collectors.toMap(Header::getName, h -> Collections.singletonList(h.getValue())));
- }
-
- @Override
- public byte[] getErrorResponse() throws IOException {
- return getBody();
- }
-
- @Override
- public int getResponseCode() {
- return response.getStatusLine().getStatusCode();
- }
-
- @Override
- public String getMessage() throws IOException {
- return appendErrorMessage(
- response.getStatusLine().getReasonPhrase(), new String(getErrorResponse()));
- }
- });
- } catch (IOException e) {
- future.completeExceptionally(e);
- }
- return future;
- }
-
- private RequestConfig getRequestConfig(HttpClientConfig clientConfig) {
-
- // TODO config
- return RequestConfig.custom().build();
- }
-
- @Override
- public void close() {
- try {
- closeableHttpClient.close();
- } catch (IOException e) {
-
- }
- }
-
- @Override
- public void close(int timeout) {}
-
- @Override
- public boolean isClosed() {
- // TODO close judge
- return true;
- }
-
- public CloseableHttpClient createHttpClient() {
- PoolingHttpClientConnectionManager connectionManager = new PoolingHttpClientConnectionManager();
- return HttpClients.custom().setConnectionManager(connectionManager).build();
- }
-
- protected HttpRequestBase createHttpUriRequest(String httpMethod, RequestTemplate requestTemplate) {
- String uri = requestTemplate.getURL();
- HttpRequestBase httpUriRequest = null;
- if (HttpGet.METHOD_NAME.equals(httpMethod)) {
- httpUriRequest = new HttpGet(uri);
- } else if (HttpHead.METHOD_NAME.equals(httpMethod)) {
- httpUriRequest = new HttpHead(uri);
- } else if (HttpPost.METHOD_NAME.equals(httpMethod)) {
- httpUriRequest = new HttpPost(uri);
- } else if (HttpPut.METHOD_NAME.equals(httpMethod)) {
- httpUriRequest = new HttpPut(uri);
- } else if (HttpPatch.METHOD_NAME.equals(httpMethod)) {
- httpUriRequest = new HttpPatch(uri);
- } else if (HttpDelete.METHOD_NAME.equals(httpMethod)) {
- httpUriRequest = new HttpDelete(uri);
- } else if (HttpOptions.METHOD_NAME.equals(httpMethod)) {
- httpUriRequest = new HttpOptions(uri);
- } else if (HttpTrace.METHOD_NAME.equals(httpMethod)) {
- httpUriRequest = new HttpTrace(uri);
- } else {
- throw new IllegalArgumentException("Invalid HTTP method: " + httpMethod);
- }
- return httpUriRequest;
- }
-}
diff --git a/dubbo-remoting/dubbo-remoting-http/src/main/java/org/apache/dubbo/remoting/http/restclient/OKHttpRestClient.java b/dubbo-remoting/dubbo-remoting-http/src/main/java/org/apache/dubbo/remoting/http/restclient/OKHttpRestClient.java
deleted file mode 100644
index 762be4b2cd2..00000000000
--- a/dubbo-remoting/dubbo-remoting-http/src/main/java/org/apache/dubbo/remoting/http/restclient/OKHttpRestClient.java
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * 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.remoting.http.restclient;
-
-import org.apache.dubbo.remoting.http.RequestTemplate;
-import org.apache.dubbo.remoting.http.RestClient;
-import org.apache.dubbo.remoting.http.RestResult;
-import org.apache.dubbo.remoting.http.config.HttpClientConfig;
-
-import java.io.IOException;
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.CompletableFuture;
-import java.util.concurrent.TimeUnit;
-
-import okhttp3.Call;
-import okhttp3.Callback;
-import okhttp3.ConnectionPool;
-import okhttp3.OkHttpClient;
-import okhttp3.Request;
-import okhttp3.RequestBody;
-import okhttp3.Response;
-import okhttp3.ResponseBody;
-import okhttp3.internal.http.HttpMethod;
-
-// TODO add version 4.0 implements ,and default version is < 4.0,for dependency conflict
-public class OKHttpRestClient implements RestClient {
- private final OkHttpClient okHttpClient;
- private final HttpClientConfig httpClientConfig;
-
- public OKHttpRestClient(HttpClientConfig clientConfig) {
- this.okHttpClient = createHttpClient(clientConfig);
- this.httpClientConfig = clientConfig;
- }
-
- @Override
- public CompletableFuture send(RequestTemplate requestTemplate) {
-
- Request.Builder builder = new Request.Builder();
- // url
- builder.url(requestTemplate.getURL());
-
- Map> allHeaders = requestTemplate.getAllHeaders();
-
- boolean hasBody = false;
- RequestBody requestBody = null;
- // GET & HEAD body is forbidden
- if (HttpMethod.permitsRequestBody(requestTemplate.getHttpMethod())) {
- requestBody = RequestBody.create(null, requestTemplate.getSerializedBody());
- hasBody = true;
- }
-
- // header
- for (String headerName : allHeaders.keySet()) {
- Collection headerValues = allHeaders.get(headerName);
- if (!hasBody && "Content-Length".equals(headerName)) {
- continue;
- }
- for (String headerValue : headerValues) {
-
- builder.addHeader(headerName, headerValue);
- }
- }
-
- builder.method(requestTemplate.getHttpMethod(), requestBody);
-
- CompletableFuture future = new CompletableFuture<>();
-
- okHttpClient.newCall(builder.build()).enqueue(new Callback() {
- @Override
- public void onFailure(Call call, IOException e) {
- future.completeExceptionally(e);
- }
-
- @Override
- public void onResponse(Call call, Response response) throws IOException {
- future.complete(new RestResult() {
- @Override
- public String getContentType() {
- return response.header("Content-Type");
- }
-
- @Override
- public byte[] getBody() throws IOException {
- ResponseBody body = response.body();
- return body == null ? null : body.bytes();
- }
-
- @Override
- public Map> headers() {
- return response.headers().toMultimap();
- }
-
- @Override
- public byte[] getErrorResponse() throws IOException {
- return getBody();
- }
-
- @Override
- public int getResponseCode() throws IOException {
- return response.code();
- }
-
- @Override
- public String getMessage() throws IOException {
- return appendErrorMessage(response.message(), new String(getBody()));
- }
- });
- }
- });
-
- return future;
- }
-
- @Override
- public void close() {
- okHttpClient.connectionPool().evictAll();
- }
-
- @Override
- public void close(int timeout) {}
-
- @Override
- public boolean isClosed() {
- return okHttpClient.retryOnConnectionFailure();
- }
-
- public OkHttpClient createHttpClient(HttpClientConfig httpClientConfig) {
-
- return new OkHttpClient.Builder()
- .readTimeout(httpClientConfig.getReadTimeout(), TimeUnit.SECONDS)
- .writeTimeout(httpClientConfig.getWriteTimeout(), TimeUnit.SECONDS)
- .connectTimeout(httpClientConfig.getConnectTimeout(), TimeUnit.SECONDS)
- .connectionPool(new ConnectionPool(
- httpClientConfig.getMaxIdleConnections(),
- httpClientConfig.getKeepAliveDuration(),
- TimeUnit.SECONDS))
- .build();
- }
-}
diff --git a/dubbo-remoting/dubbo-remoting-http/src/main/java/org/apache/dubbo/remoting/http/restclient/URLConnectionRestClient.java b/dubbo-remoting/dubbo-remoting-http/src/main/java/org/apache/dubbo/remoting/http/restclient/URLConnectionRestClient.java
deleted file mode 100644
index 65f20a19f28..00000000000
--- a/dubbo-remoting/dubbo-remoting-http/src/main/java/org/apache/dubbo/remoting/http/restclient/URLConnectionRestClient.java
+++ /dev/null
@@ -1,170 +0,0 @@
-/*
- * 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.remoting.http.restclient;
-
-import org.apache.dubbo.remoting.http.RequestTemplate;
-import org.apache.dubbo.remoting.http.RestClient;
-import org.apache.dubbo.remoting.http.RestResult;
-import org.apache.dubbo.remoting.http.config.HttpClientConfig;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.net.HttpURLConnection;
-import java.net.URL;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.CompletableFuture;
-import java.util.zip.DeflaterOutputStream;
-import java.util.zip.GZIPOutputStream;
-
-import org.apache.commons.io.IOUtils;
-
-public class URLConnectionRestClient implements RestClient {
- private final HttpClientConfig clientConfig;
-
- public URLConnectionRestClient(HttpClientConfig clientConfig) {
- this.clientConfig = clientConfig;
- }
-
- @Override
- public CompletableFuture send(RequestTemplate requestTemplate) {
-
- CompletableFuture future = new CompletableFuture<>();
-
- try {
- HttpURLConnection connection = (HttpURLConnection) new URL(requestTemplate.getURL()).openConnection();
- connection.setConnectTimeout(clientConfig.getConnectTimeout());
- connection.setReadTimeout(clientConfig.getReadTimeout());
- connection.setRequestMethod(requestTemplate.getHttpMethod());
-
- prepareConnection(connection, requestTemplate.getHttpMethod());
-
- // writeHeaders
-
- for (String field : requestTemplate.getAllHeaders().keySet()) {
- for (String value : requestTemplate.getHeaders(field)) {
- connection.addRequestProperty(field, value);
- }
- }
-
- // writeBody
-
- boolean gzipEncodedRequest = requestTemplate.isGzipEncodedRequest();
- boolean deflateEncodedRequest = requestTemplate.isDeflateEncodedRequest();
- if (requestTemplate.isBodyEmpty()) {
- future.complete(getRestResultFromConnection(connection));
- return future;
- }
- Integer contentLength = requestTemplate.getContentLength();
-
- if (contentLength != null) {
- connection.setFixedLengthStreamingMode(contentLength);
- } else {
- connection.setChunkedStreamingMode(clientConfig.getChunkLength());
- }
-
- OutputStream out = connection.getOutputStream();
- if (gzipEncodedRequest) {
- out = new GZIPOutputStream(out);
- } else if (deflateEncodedRequest) {
- out = new DeflaterOutputStream(out);
- }
- try {
- out.write(requestTemplate.getSerializedBody());
- } finally {
- try {
- out.close();
- } catch (IOException suppressed) {
- }
- }
-
- future.complete(getRestResultFromConnection(connection));
- } catch (Exception e) {
- future.completeExceptionally(e);
- }
-
- return future;
- }
-
- @Override
- public void close() {}
-
- @Override
- public void close(int timeout) {}
-
- @Override
- public boolean isClosed() {
- return true;
- }
-
- private RestResult getRestResultFromConnection(HttpURLConnection connection) {
-
- return new RestResult() {
- @Override
- public String getContentType() {
- return connection.getContentType();
- }
-
- @Override
- public byte[] getBody() throws IOException {
- return IOUtils.toByteArray(connection.getInputStream());
- }
-
- @Override
- public Map> headers() {
- return connection.getHeaderFields();
- }
-
- @Override
- public byte[] getErrorResponse() throws IOException {
- return IOUtils.toByteArray(connection.getErrorStream());
- }
-
- @Override
- public int getResponseCode() throws IOException {
- return connection.getResponseCode();
- }
-
- @Override
- public String getMessage() throws IOException {
- return appendErrorMessage(connection.getResponseMessage(), new String(getErrorResponse()));
- }
- };
- }
-
- private void prepareConnection(HttpURLConnection connection, String httpMethod) throws IOException {
-
- connection.setDoInput(true);
-
- if ("GET".equals(httpMethod)) {
- connection.setInstanceFollowRedirects(true);
- } else {
- connection.setInstanceFollowRedirects(false);
- }
-
- if ("POST".equals(httpMethod)
- || "PUT".equals(httpMethod)
- || "PATCH".equals(httpMethod)
- || "DELETE".equals(httpMethod)) {
- connection.setDoOutput(true);
- } else {
- connection.setDoOutput(false);
- }
-
- connection.setRequestMethod(httpMethod);
- }
-}
diff --git a/dubbo-remoting/dubbo-remoting-http/src/main/java/org/apache/dubbo/remoting/http/servlet/BootstrapListener.java b/dubbo-remoting/dubbo-remoting-http/src/main/java/org/apache/dubbo/remoting/http/servlet/BootstrapListener.java
deleted file mode 100644
index 0a902f292f9..00000000000
--- a/dubbo-remoting/dubbo-remoting-http/src/main/java/org/apache/dubbo/remoting/http/servlet/BootstrapListener.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * 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.remoting.http.servlet;
-
-import javax.servlet.ServletContextEvent;
-import javax.servlet.ServletContextListener;
-
-/**
- * This class must be defined before something like spring's ContextLoaderListener in web.xml
- */
-public class BootstrapListener implements ServletContextListener {
-
- @Override
- public void contextInitialized(ServletContextEvent servletContextEvent) {
- ServletManager.getInstance()
- .addServletContext(ServletManager.EXTERNAL_SERVER_PORT, servletContextEvent.getServletContext());
- }
-
- @Override
- public void contextDestroyed(ServletContextEvent servletContextEvent) {
- ServletManager.getInstance().removeServletContext(ServletManager.EXTERNAL_SERVER_PORT);
- }
-}
diff --git a/dubbo-remoting/dubbo-remoting-http/src/main/java/org/apache/dubbo/remoting/http/servlet/DispatcherServlet.java b/dubbo-remoting/dubbo-remoting-http/src/main/java/org/apache/dubbo/remoting/http/servlet/DispatcherServlet.java
deleted file mode 100644
index 0f2358cee07..00000000000
--- a/dubbo-remoting/dubbo-remoting-http/src/main/java/org/apache/dubbo/remoting/http/servlet/DispatcherServlet.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * 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.remoting.http.servlet;
-
-import org.apache.dubbo.remoting.http.HttpHandler;
-
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import java.io.IOException;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-/**
- * Service dispatcher Servlet.
- */
-public class DispatcherServlet extends HttpServlet {
-
- private static final long serialVersionUID = 5766349180380479888L;
- private static final Map HANDLERS = new ConcurrentHashMap<>();
- private static DispatcherServlet INSTANCE;
-
- public DispatcherServlet() {
- DispatcherServlet.INSTANCE = this;
- }
-
- public static void addHttpHandler(int port, HttpHandler processor) {
- HANDLERS.put(port, processor);
- }
-
- public static void removeHttpHandler(int port) {
- HANDLERS.remove(port);
- }
-
- public static DispatcherServlet getInstance() {
- return INSTANCE;
- }
-
- @Override
- protected void service(HttpServletRequest request, HttpServletResponse response)
- throws ServletException, IOException {
- HttpHandler handler = HANDLERS.get(request.getLocalPort());
- if (handler == null) { // service not found.
- response.sendError(HttpServletResponse.SC_NOT_FOUND, "Service not found.");
- } else {
- handler.handle(request, response);
- }
- }
-}
diff --git a/dubbo-remoting/dubbo-remoting-http/src/main/java/org/apache/dubbo/remoting/http/servlet/ServletHttpBinder.java b/dubbo-remoting/dubbo-remoting-http/src/main/java/org/apache/dubbo/remoting/http/servlet/ServletHttpBinder.java
deleted file mode 100644
index 33aecc5aff5..00000000000
--- a/dubbo-remoting/dubbo-remoting-http/src/main/java/org/apache/dubbo/remoting/http/servlet/ServletHttpBinder.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * 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.remoting.http.servlet;
-
-import org.apache.dubbo.common.URL;
-import org.apache.dubbo.remoting.http.HttpBinder;
-import org.apache.dubbo.remoting.http.HttpHandler;
-import org.apache.dubbo.remoting.http.HttpServer;
-
-/**
- * ServletHttpTransporter
- */
-public class ServletHttpBinder implements HttpBinder {
-
- @Override
- public HttpServer bind(URL url, HttpHandler handler) {
- return new ServletHttpServer(url, handler);
- }
-}
diff --git a/dubbo-remoting/dubbo-remoting-http/src/main/java/org/apache/dubbo/remoting/http/servlet/ServletHttpServer.java b/dubbo-remoting/dubbo-remoting-http/src/main/java/org/apache/dubbo/remoting/http/servlet/ServletHttpServer.java
deleted file mode 100644
index bf0b01457e1..00000000000
--- a/dubbo-remoting/dubbo-remoting-http/src/main/java/org/apache/dubbo/remoting/http/servlet/ServletHttpServer.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * 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.remoting.http.servlet;
-
-import org.apache.dubbo.common.URL;
-import org.apache.dubbo.remoting.Constants;
-import org.apache.dubbo.remoting.http.HttpHandler;
-import org.apache.dubbo.remoting.http.support.AbstractHttpServer;
-
-public class ServletHttpServer extends AbstractHttpServer {
-
- public ServletHttpServer(URL url, HttpHandler handler) {
- super(url, handler);
- DispatcherServlet.addHttpHandler(url.getParameter(Constants.BIND_PORT_KEY, 8080), handler);
- }
-}
diff --git a/dubbo-remoting/dubbo-remoting-http/src/main/java/org/apache/dubbo/remoting/http/servlet/ServletManager.java b/dubbo-remoting/dubbo-remoting-http/src/main/java/org/apache/dubbo/remoting/http/servlet/ServletManager.java
deleted file mode 100644
index dc71cd862dc..00000000000
--- a/dubbo-remoting/dubbo-remoting-http/src/main/java/org/apache/dubbo/remoting/http/servlet/ServletManager.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * 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.remoting.http.servlet;
-
-import javax.servlet.ServletContext;
-
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-/**
- * TODO this may not be a pretty elegant solution,
- */
-public class ServletManager {
-
- public static final int EXTERNAL_SERVER_PORT = -1234;
-
- private static final ServletManager INSTANCE = new ServletManager();
-
- private final Map contextMap = new ConcurrentHashMap<>();
-
- public static ServletManager getInstance() {
- return INSTANCE;
- }
-
- public void addServletContext(int port, ServletContext servletContext) {
- contextMap.put(port, servletContext);
- }
-
- public void removeServletContext(int port) {
- contextMap.remove(port);
- }
-
- public ServletContext getServletContext(int port) {
- return contextMap.get(port);
- }
-}
diff --git a/dubbo-remoting/dubbo-remoting-http/src/main/java/org/apache/dubbo/remoting/http/support/AbstractHttpServer.java b/dubbo-remoting/dubbo-remoting-http/src/main/java/org/apache/dubbo/remoting/http/support/AbstractHttpServer.java
deleted file mode 100644
index cc01b1e0645..00000000000
--- a/dubbo-remoting/dubbo-remoting-http/src/main/java/org/apache/dubbo/remoting/http/support/AbstractHttpServer.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * 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.remoting.http.support;
-
-import org.apache.dubbo.common.Parameters;
-import org.apache.dubbo.common.URL;
-import org.apache.dubbo.remoting.Channel;
-import org.apache.dubbo.remoting.ChannelHandler;
-import org.apache.dubbo.remoting.RemotingException;
-import org.apache.dubbo.remoting.http.HttpHandler;
-import org.apache.dubbo.remoting.http.HttpServer;
-
-import java.net.InetSocketAddress;
-import java.util.Collection;
-
-/**
- * AbstractHttpServer
- */
-public abstract class AbstractHttpServer implements HttpServer {
-
- private final URL url;
-
- private final HttpHandler handler;
-
- private volatile boolean closed;
-
- public AbstractHttpServer(URL url, HttpHandler handler) {
- if (url == null) {
- throw new IllegalArgumentException("url == null");
- }
- if (handler == null) {
- throw new IllegalArgumentException("handler == null");
- }
- this.url = url;
- this.handler = handler;
- }
-
- @Override
- public HttpHandler getHttpHandler() {
- return handler;
- }
-
- @Override
- public URL getUrl() {
- return url;
- }
-
- @Override
- public void reset(URL url) {}
-
- @Override
- public boolean isBound() {
- return true;
- }
-
- @Override
- public InetSocketAddress getLocalAddress() {
- return url.toInetSocketAddress();
- }
-
- @Override
- public void close() {
- closed = true;
- }
-
- @Override
- public void close(int timeout) {
- close();
- }
-
- @Override
- public boolean isClosed() {
- return closed;
- }
-
- /**
- * Following methods are extended from RemotingServer, useless for http servers
- */
- @Override
- public boolean canHandleIdle() {
- return false;
- }
-
- @Override
- public Collection getChannels() {
- return null;
- }
-
- @Override
- public Channel getChannel(InetSocketAddress remoteAddress) {
- return null;
- }
-
- @Override
- public void reset(Parameters parameters) {}
-
- @Override
- public ChannelHandler getChannelHandler() {
- return null;
- }
-
- @Override
- public void send(Object message) throws RemotingException {}
-
- @Override
- public void send(Object message, boolean sent) throws RemotingException {}
-
- @Override
- public void startClose() {}
-}
diff --git a/dubbo-remoting/dubbo-remoting-http/src/main/java/org/apache/dubbo/remoting/http/tomcat/TomcatHttpBinder.java b/dubbo-remoting/dubbo-remoting-http/src/main/java/org/apache/dubbo/remoting/http/tomcat/TomcatHttpBinder.java
deleted file mode 100755
index 92b4bf1c70b..00000000000
--- a/dubbo-remoting/dubbo-remoting-http/src/main/java/org/apache/dubbo/remoting/http/tomcat/TomcatHttpBinder.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * 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.remoting.http.tomcat;
-
-import org.apache.dubbo.common.URL;
-import org.apache.dubbo.remoting.http.HttpBinder;
-import org.apache.dubbo.remoting.http.HttpHandler;
-import org.apache.dubbo.remoting.http.HttpServer;
-
-public class TomcatHttpBinder implements HttpBinder {
-
- @Override
- public HttpServer bind(URL url, HttpHandler handler) {
- return new TomcatHttpServer(url, handler);
- }
-}
diff --git a/dubbo-remoting/dubbo-remoting-http/src/main/java/org/apache/dubbo/remoting/http/tomcat/TomcatHttpServer.java b/dubbo-remoting/dubbo-remoting-http/src/main/java/org/apache/dubbo/remoting/http/tomcat/TomcatHttpServer.java
deleted file mode 100755
index 002f963c350..00000000000
--- a/dubbo-remoting/dubbo-remoting-http/src/main/java/org/apache/dubbo/remoting/http/tomcat/TomcatHttpServer.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * 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.remoting.http.tomcat;
-
-import org.apache.dubbo.common.URL;
-import org.apache.dubbo.common.logger.ErrorTypeAwareLogger;
-import org.apache.dubbo.common.logger.LoggerFactory;
-import org.apache.dubbo.common.utils.SystemPropertyConfigUtils;
-import org.apache.dubbo.remoting.http.HttpHandler;
-import org.apache.dubbo.remoting.http.servlet.DispatcherServlet;
-import org.apache.dubbo.remoting.http.servlet.ServletManager;
-import org.apache.dubbo.remoting.http.support.AbstractHttpServer;
-
-import java.io.File;
-
-import org.apache.catalina.Context;
-import org.apache.catalina.LifecycleException;
-import org.apache.catalina.connector.Connector;
-import org.apache.catalina.startup.Tomcat;
-
-import static org.apache.dubbo.common.constants.CommonConstants.DEFAULT_THREADS;
-import static org.apache.dubbo.common.constants.CommonConstants.SystemProperty.SYSTEM_JAVA_IO_TMPDIR;
-import static org.apache.dubbo.common.constants.CommonConstants.THREADS_KEY;
-import static org.apache.dubbo.common.constants.LoggerCodeConstants.COMMON_FAILED_STOP_HTTP_SERVER;
-import static org.apache.dubbo.remoting.Constants.ACCEPTS_KEY;
-
-public class TomcatHttpServer extends AbstractHttpServer {
-
- private static final ErrorTypeAwareLogger logger = LoggerFactory.getErrorTypeAwareLogger(TomcatHttpServer.class);
-
- private final Tomcat tomcat;
-
- private final URL url;
-
- public TomcatHttpServer(URL url, final HttpHandler handler) {
- super(url, handler);
-
- this.url = url;
- DispatcherServlet.addHttpHandler(url.getPort(), handler);
- String baseDir = new File(SystemPropertyConfigUtils.getSystemProperty(SYSTEM_JAVA_IO_TMPDIR)).getAbsolutePath();
- tomcat = new Tomcat();
-
- Connector connector = tomcat.getConnector();
- connector.setPort(url.getPort());
- connector.setProperty("maxThreads", String.valueOf(url.getParameter(THREADS_KEY, DEFAULT_THREADS)));
- connector.setProperty("maxConnections", String.valueOf(url.getParameter(ACCEPTS_KEY, -1)));
- connector.setProperty("URIEncoding", "UTF-8");
- connector.setProperty("connectionTimeout", "60000");
- connector.setProperty("maxKeepAliveRequests", "-1");
-
- tomcat.setBaseDir(baseDir);
- tomcat.setPort(url.getPort());
-
- Context context = tomcat.addContext("/", baseDir);
- Tomcat.addServlet(context, "dispatcher", new DispatcherServlet());
- // Issue : https://github.com/apache/dubbo/issues/6418
- // addServletMapping method will be removed since Tomcat 9
- // context.addServletMapping("/*", "dispatcher");
- context.addServletMappingDecoded("/*", "dispatcher");
- ServletManager.getInstance().addServletContext(url.getPort(), context.getServletContext());
-
- // tell tomcat to fail on startup failures.
- System.setProperty("org.apache.catalina.startup.EXIT_ON_INIT_FAILURE", "true");
-
- try {
- tomcat.start();
- } catch (LifecycleException e) {
- throw new IllegalStateException("Failed to start tomcat server at " + url.getAddress(), e);
- }
- }
-
- @Override
- public void close() {
- super.close();
-
- ServletManager.getInstance().removeServletContext(url.getPort());
-
- try {
- tomcat.stop();
- // close port by destroy()
- tomcat.destroy();
- } catch (Exception e) {
- logger.warn(COMMON_FAILED_STOP_HTTP_SERVER, "", "", e.getMessage(), e);
- }
- }
-}
diff --git a/dubbo-remoting/dubbo-remoting-http/src/main/resources/META-INF/dubbo/internal/org.apache.dubbo.remoting.http.HttpBinder b/dubbo-remoting/dubbo-remoting-http/src/main/resources/META-INF/dubbo/internal/org.apache.dubbo.remoting.http.HttpBinder
deleted file mode 100644
index 845124bb435..00000000000
--- a/dubbo-remoting/dubbo-remoting-http/src/main/resources/META-INF/dubbo/internal/org.apache.dubbo.remoting.http.HttpBinder
+++ /dev/null
@@ -1,3 +0,0 @@
-servlet=org.apache.dubbo.remoting.http.servlet.ServletHttpBinder
-jetty=org.apache.dubbo.remoting.http.jetty.JettyHttpBinder
-tomcat=org.apache.dubbo.remoting.http.tomcat.TomcatHttpBinder
\ No newline at end of file
diff --git a/dubbo-remoting/dubbo-remoting-http/src/main/resources/META-INF/dubbo/internal/org.apache.dubbo.remoting.http.factory.RestClientFactory b/dubbo-remoting/dubbo-remoting-http/src/main/resources/META-INF/dubbo/internal/org.apache.dubbo.remoting.http.factory.RestClientFactory
deleted file mode 100644
index 95dd12e072d..00000000000
--- a/dubbo-remoting/dubbo-remoting-http/src/main/resources/META-INF/dubbo/internal/org.apache.dubbo.remoting.http.factory.RestClientFactory
+++ /dev/null
@@ -1,4 +0,0 @@
-ok-http=org.apache.dubbo.remoting.http.factory.impl.OkHttpClientFactory
-url-connection=org.apache.dubbo.remoting.http.factory.impl.URLConnectionClientFactory
-apache-http-client=org.apache.dubbo.remoting.http.factory.impl.ApacheHttpClientFactory
-
diff --git a/dubbo-remoting/dubbo-remoting-http/src/test/java/org/apache/dubbo/remoting/http/jetty/JettyHttpBinderTest.java b/dubbo-remoting/dubbo-remoting-http/src/test/java/org/apache/dubbo/remoting/http/jetty/JettyHttpBinderTest.java
deleted file mode 100644
index 04fc431863c..00000000000
--- a/dubbo-remoting/dubbo-remoting-http/src/test/java/org/apache/dubbo/remoting/http/jetty/JettyHttpBinderTest.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * 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.remoting.http.jetty;
-
-import org.apache.dubbo.common.URL;
-import org.apache.dubbo.common.url.component.ServiceConfigURL;
-import org.apache.dubbo.common.utils.NetUtils;
-import org.apache.dubbo.remoting.Constants;
-import org.apache.dubbo.remoting.http.HttpHandler;
-import org.apache.dubbo.remoting.http.HttpServer;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import java.io.IOException;
-
-import org.apache.http.client.fluent.Request;
-import org.junit.jupiter.api.Test;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.core.Is.is;
-
-class JettyHttpBinderTest {
- @Test
- void shouldAbleHandleRequestForJettyBinder() throws Exception {
- int port = NetUtils.getAvailablePort();
- URL url = new ServiceConfigURL(
- "http", "localhost", port, new String[] {Constants.BIND_PORT_KEY, String.valueOf(port)});
- HttpServer httpServer = new JettyHttpServer(url, new HttpHandler() {
- @Override
- public void handle(HttpServletRequest request, HttpServletResponse response) throws IOException {
- response.getWriter().write("Jetty");
- }
- });
-
- String response =
- Request.Get(url.toJavaURL().toURI()).execute().returnContent().asString();
-
- assertThat(response, is("Jetty"));
-
- httpServer.close();
- }
-}
diff --git a/dubbo-remoting/dubbo-remoting-http/src/test/java/org/apache/dubbo/remoting/http/jetty/JettyLoggerAdapterTest.java b/dubbo-remoting/dubbo-remoting-http/src/test/java/org/apache/dubbo/remoting/http/jetty/JettyLoggerAdapterTest.java
deleted file mode 100644
index e4cbbfd5397..00000000000
--- a/dubbo-remoting/dubbo-remoting-http/src/test/java/org/apache/dubbo/remoting/http/jetty/JettyLoggerAdapterTest.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * 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.remoting.http.jetty;
-
-import org.apache.dubbo.common.URL;
-import org.apache.dubbo.common.logger.Logger;
-import org.apache.dubbo.common.logger.support.FailsafeErrorTypeAwareLogger;
-import org.apache.dubbo.common.url.component.ServiceConfigURL;
-import org.apache.dubbo.common.utils.NetUtils;
-import org.apache.dubbo.remoting.Constants;
-import org.apache.dubbo.remoting.http.HttpHandler;
-import org.apache.dubbo.remoting.http.HttpServer;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import java.io.IOException;
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-
-import org.apache.http.client.fluent.Request;
-import org.eclipse.jetty.util.log.Log;
-import org.junit.jupiter.api.Test;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.mockito.ArgumentMatchers.anyString;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-class JettyLoggerAdapterTest {
-
- @Test
- void testJettyUseDubboLogger() throws Exception {
- int port = NetUtils.getAvailablePort();
- URL url = new ServiceConfigURL(
- "http", "localhost", port, new String[] {Constants.BIND_PORT_KEY, String.valueOf(port)});
- HttpServer httpServer = new JettyHttpServer(url, new HttpHandler() {
- @Override
- public void handle(HttpServletRequest request, HttpServletResponse response) throws IOException {
- response.getWriter().write("Jetty is using Dubbo's logger");
- }
- });
- Request.Get(url.toJavaURL().toURI()).execute().returnContent().asString();
-
- assertThat(Log.getLog().getClass().isAssignableFrom(JettyLoggerAdapter.class), is(true));
-
- httpServer.close();
- }
-
- @Test
- void testSuccessLogger() throws Exception {
- Logger successLogger = mock(Logger.class);
- Class> clazz = Class.forName("org.apache.dubbo.remoting.http.jetty.JettyLoggerAdapter");
- JettyLoggerAdapter jettyLoggerAdapter =
- (JettyLoggerAdapter) clazz.getDeclaredConstructor().newInstance();
-
- Field loggerField = clazz.getDeclaredField("logger");
- loggerField.setAccessible(true);
- loggerField.set(jettyLoggerAdapter, new FailsafeErrorTypeAwareLogger(successLogger));
- jettyLoggerAdapter.setDebugEnabled(true);
-
- when(successLogger.isDebugEnabled()).thenReturn(true);
- when(successLogger.isWarnEnabled()).thenReturn(true);
- when(successLogger.isInfoEnabled()).thenReturn(true);
-
- jettyLoggerAdapter.warn("warn");
- jettyLoggerAdapter.info("info");
- jettyLoggerAdapter.debug("debug");
-
- verify(successLogger).warn(anyString());
- verify(successLogger).info(anyString());
- verify(successLogger).debug(anyString());
-
- jettyLoggerAdapter.warn(new Exception("warn"));
- jettyLoggerAdapter.info(new Exception("info"));
- jettyLoggerAdapter.debug(new Exception("debug"));
- jettyLoggerAdapter.ignore(new Exception("ignore"));
-
- jettyLoggerAdapter.warn("warn", new Exception("warn"));
- jettyLoggerAdapter.info("info", new Exception("info"));
- jettyLoggerAdapter.debug("debug", new Exception("debug"));
- }
-
- @Test
- void testNewLogger() {
- JettyLoggerAdapter loggerAdapter = new JettyLoggerAdapter();
- org.eclipse.jetty.util.log.Logger logger =
- loggerAdapter.newLogger(this.getClass().getName());
- assertThat(logger.getClass().isAssignableFrom(JettyLoggerAdapter.class), is(true));
- }
-
- @Test
- void testDebugEnabled() {
- JettyLoggerAdapter loggerAdapter = new JettyLoggerAdapter();
- loggerAdapter.setDebugEnabled(true);
- assertThat(loggerAdapter.isDebugEnabled(), is(true));
- }
-
- @Test
- void testLoggerFormat() throws Exception {
- Class> clazz = Class.forName("org.apache.dubbo.remoting.http.jetty.JettyLoggerAdapter");
- Object newInstance = clazz.getDeclaredConstructor().newInstance();
-
- Method method = clazz.getDeclaredMethod("format", String.class, Object[].class);
- method.setAccessible(true);
-
- String print = (String) method.invoke(newInstance, "Hello,{}! I'am {}", new String[] {"World", "Jetty"});
-
- assertThat(print, is("Hello,World! I'am Jetty"));
- }
-}
diff --git a/dubbo-remoting/dubbo-remoting-http/src/test/java/org/apache/dubbo/remoting/http/rest/RestClientTest.java b/dubbo-remoting/dubbo-remoting-http/src/test/java/org/apache/dubbo/remoting/http/rest/RestClientTest.java
deleted file mode 100644
index 571861ae3d9..00000000000
--- a/dubbo-remoting/dubbo-remoting-http/src/test/java/org/apache/dubbo/remoting/http/rest/RestClientTest.java
+++ /dev/null
@@ -1,240 +0,0 @@
-/*
- * 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.remoting.http.rest;
-
-import org.apache.dubbo.common.URL;
-import org.apache.dubbo.common.url.component.ServiceConfigURL;
-import org.apache.dubbo.common.utils.NetUtils;
-import org.apache.dubbo.remoting.Constants;
-import org.apache.dubbo.remoting.http.*;
-import org.apache.dubbo.remoting.http.config.HttpClientConfig;
-import org.apache.dubbo.remoting.http.jetty.JettyHttpServer;
-import org.apache.dubbo.remoting.http.restclient.HttpClientRestClient;
-import org.apache.dubbo.remoting.http.restclient.OKHttpRestClient;
-import org.apache.dubbo.remoting.http.restclient.URLConnectionRestClient;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import java.io.IOException;
-import java.nio.charset.StandardCharsets;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.CompletableFuture;
-
-import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.Test;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.core.Is.is;
-
-public class RestClientTest {
-
- @Test
- public void testRestClient() throws Exception {
- int port = NetUtils.getAvailablePort();
- URL url = new ServiceConfigURL(
- "http", "localhost", port, new String[] {Constants.BIND_PORT_KEY, String.valueOf(port)});
- HttpServer httpServer = new JettyHttpServer(url, new HttpHandler() {
- @Override
- public void handle(HttpServletRequest request, HttpServletResponse response) throws IOException {
- response.getWriter().write("Jetty");
- }
- });
-
- RequestTemplate requestTemplate = new RequestTemplate(null, "POST", "localhost:" + port);
-
- requestTemplate.addParam("p1", "value1");
- requestTemplate.addParam("p2", "value2");
-
- requestTemplate.addParams("p3", Arrays.asList("value3", "value3.1"));
- requestTemplate.addHeader("test", "dubbo");
- requestTemplate.addKeepAliveHeader(60);
-
- requestTemplate.addHeaders("header", Arrays.asList("h1", "h2"));
-
- requestTemplate.path("/test");
- requestTemplate.serializeBody("test".getBytes(StandardCharsets.UTF_8));
-
- RestClient restClient = new OKHttpRestClient(new HttpClientConfig());
-
- CompletableFuture send = restClient.send(requestTemplate);
-
- RestResult restResult = send.get();
-
- assertThat(new String(restResult.getBody()), is("Jetty"));
-
- restClient = new HttpClientRestClient(new HttpClientConfig());
-
- send = restClient.send(requestTemplate);
-
- restResult = send.get();
-
- assertThat(new String(restResult.getBody()), is("Jetty"));
-
- restClient = new URLConnectionRestClient(new HttpClientConfig());
-
- send = restClient.send(requestTemplate);
-
- restResult = send.get();
-
- assertThat(new String(restResult.getBody()), is("Jetty"));
-
- httpServer.close();
- }
-
- @Test
- public void testError() throws Exception {
- int port = NetUtils.getAvailablePort();
- URL url = new ServiceConfigURL(
- "http", "localhost", port, new String[] {Constants.BIND_PORT_KEY, String.valueOf(port)});
- HttpServer httpServer = new JettyHttpServer(url, new HttpHandler() {
- @Override
- public void handle(HttpServletRequest request, HttpServletResponse response) throws IOException {
- response.setStatus(500);
- response.getWriter().write("server error");
- response.addHeader("Content-Type", "text/html");
- }
- });
-
- RequestTemplate requestTemplate = new RequestTemplate(null, null, null);
-
- requestTemplate.httpMethod("POST");
- requestTemplate.setAddress("localhost:" + port);
- requestTemplate.setProtocol("http://");
- requestTemplate.addHeader("test", "dubbo");
- requestTemplate.path("/test");
- requestTemplate.serializeBody("test".getBytes(StandardCharsets.UTF_8));
-
- RestClient restClient = new OKHttpRestClient(new HttpClientConfig());
-
- CompletableFuture send = restClient.send(requestTemplate);
-
- String error = "Server Error\n" + " error info is: server error";
- RestResult restResult = send.get();
-
- String contentType = "text/html;charset=iso-8859-1";
-
- Assertions.assertEquals(500, restResult.getResponseCode());
- Assertions.assertEquals(error, restResult.getMessage());
- Assertions.assertEquals(contentType, restResult.getContentType());
-
- Map> headers = restResult.headers();
- restClient.close();
-
- restClient = new HttpClientRestClient(new HttpClientConfig());
- send = restClient.send(requestTemplate);
- restResult = send.get();
-
- Assertions.assertEquals(500, restResult.getResponseCode());
- Assertions.assertEquals(error, restResult.getMessage());
- Assertions.assertEquals(contentType, restResult.getContentType());
-
- restClient.close();
-
- restClient = new URLConnectionRestClient(new HttpClientConfig());
- send = restClient.send(requestTemplate);
- restResult = send.get();
-
- Assertions.assertEquals(500, restResult.getResponseCode());
- Assertions.assertEquals(error, restResult.getMessage());
- Assertions.assertEquals(contentType, restResult.getContentType());
- restClient.close();
-
- httpServer.close();
- }
-
- @Test
- public void testMethod() {
-
- RequestTemplate requestTemplate = new RequestTemplate(null, null, null);
-
- requestTemplate.body(new Object(), Object.class);
-
- Assertions.assertEquals(requestTemplate.getBodyType(), Object.class);
-
- requestTemplate.addHeader("Content-Length", 1);
-
- Integer contentLength = requestTemplate.getContentLength();
-
- Assertions.assertEquals(1, contentLength);
-
- List strings = Arrays.asList("h1", "h2");
-
- requestTemplate.addHeaders("header", strings);
-
- Assertions.assertArrayEquals(
- strings.toArray(new String[0]),
- requestTemplate.getHeaders("header").toArray(new String[0]));
-
- strings = Arrays.asList("p1", "p2");
-
- requestTemplate.addParams("param", strings);
-
- Assertions.assertArrayEquals(
- strings.toArray(new String[0]),
- requestTemplate.getParam("param").toArray(new String[0]));
- }
-
- @Test
- void testBuildURL() throws Exception {
- int port = NetUtils.getAvailablePort();
- URL url = new ServiceConfigURL(
- "http", "localhost", port, new String[] {Constants.BIND_PORT_KEY, String.valueOf(port)});
- HttpServer httpServer = new JettyHttpServer(url, new HttpHandler() {
- @Override
- public void handle(HttpServletRequest request, HttpServletResponse response) throws IOException {
- response.setCharacterEncoding("UTF-8");
- response.getWriter().write(request.getQueryString());
- }
- });
-
- RequestTemplate requestTemplate = new RequestTemplate(null, "POST", "localhost:" + port);
-
- requestTemplate.addParam("name", "李强");
- requestTemplate.addParam("age", "18");
- requestTemplate.path("/hello/world");
-
- // When using the OKHttpRestClient, parameters will be encoded with UTF-8 and appended to the URL
- RestClient restClient = new OKHttpRestClient(new HttpClientConfig());
-
- CompletableFuture send = restClient.send(requestTemplate);
-
- RestResult restResult = send.get();
-
- assertThat(new String(restResult.getBody()), is("name=%E6%9D%8E%E5%BC%BA&age=18"));
-
- // When using the HttpClientRestClient, parameters will be encoded with UTF-8 and appended to the URL
- restClient = new HttpClientRestClient(new HttpClientConfig());
-
- send = restClient.send(requestTemplate);
-
- restResult = send.get();
-
- assertThat(new String(restResult.getBody()), is("name=%E6%9D%8E%E5%BC%BA&age=18"));
-
- // When using the URLConnectionRestClient, parameters won't be encoded and still appended to the URL
- restClient = new URLConnectionRestClient(new HttpClientConfig());
-
- send = restClient.send(requestTemplate);
-
- restResult = send.get();
-
- assertThat(new String(restResult.getBody(), StandardCharsets.UTF_8), is("name=李强&age=18"));
- }
-}
diff --git a/dubbo-remoting/dubbo-remoting-http/src/test/java/org/apache/dubbo/remoting/http/tomcat/TomcatHttpBinderTest.java b/dubbo-remoting/dubbo-remoting-http/src/test/java/org/apache/dubbo/remoting/http/tomcat/TomcatHttpBinderTest.java
deleted file mode 100644
index 75efc28b412..00000000000
--- a/dubbo-remoting/dubbo-remoting-http/src/test/java/org/apache/dubbo/remoting/http/tomcat/TomcatHttpBinderTest.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * 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.remoting.http.tomcat;
-
-import org.apache.dubbo.common.URL;
-import org.apache.dubbo.common.url.component.ServiceConfigURL;
-import org.apache.dubbo.common.utils.NetUtils;
-import org.apache.dubbo.remoting.Constants;
-import org.apache.dubbo.remoting.http.HttpHandler;
-import org.apache.dubbo.remoting.http.HttpServer;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import java.io.IOException;
-
-import org.apache.http.client.fluent.Request;
-import org.junit.jupiter.api.Test;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.core.Is.is;
-
-class TomcatHttpBinderTest {
- @Test
- void shouldAbleHandleRequestForTomcatBinder() throws Exception {
- int port = NetUtils.getAvailablePort();
- URL url = new ServiceConfigURL(
- "http", "localhost", port, new String[] {Constants.BIND_PORT_KEY, String.valueOf(port)});
-
- HttpServer httpServer = new TomcatHttpBinder()
- .bind(url, new HttpHandler() {
- @Override
- public void handle(HttpServletRequest request, HttpServletResponse response) throws IOException {
- response.getWriter().write("Tomcat");
- }
- });
-
- String response =
- Request.Get(url.toJavaURL().toURI()).execute().returnContent().asString();
-
- assertThat(response, is("Tomcat"));
-
- httpServer.close();
- assertThat(NetUtils.isPortInUsed(port), is(false));
- }
-}
diff --git a/dubbo-remoting/dubbo-remoting-http/src/test/resources/log4j2-test.xml b/dubbo-remoting/dubbo-remoting-http/src/test/resources/log4j2-test.xml
deleted file mode 100644
index ba99f52cc2d..00000000000
--- a/dubbo-remoting/dubbo-remoting-http/src/test/resources/log4j2-test.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/dubbo-remoting/pom.xml b/dubbo-remoting/pom.xml
index 1a1d0cd0c40..e7aca3685e2 100644
--- a/dubbo-remoting/pom.xml
+++ b/dubbo-remoting/pom.xml
@@ -29,7 +29,6 @@
The remoting module of dubbo projectdubbo-remoting-api
- dubbo-remoting-httpdubbo-remoting-nettydubbo-remoting-zookeeper-apidubbo-remoting-zookeeper
diff --git a/dubbo-rpc/dubbo-rpc-rest/pom.xml b/dubbo-rpc/dubbo-rpc-rest/pom.xml
deleted file mode 100644
index 2e27452ad6a..00000000000
--- a/dubbo-rpc/dubbo-rpc-rest/pom.xml
+++ /dev/null
@@ -1,183 +0,0 @@
-
-
-
- 4.0.0
-
- org.apache.dubbo
- dubbo-rpc
- ${revision}
- ../pom.xml
-
- dubbo-rpc-rest
- jar
- ${project.artifactId}
- The rest rpc module of dubbo project
-
-
- false
-
-
-
-
- org.apache.dubbo
- dubbo-rpc-api
- ${project.parent.version}
-
-
- org.apache.dubbo
- dubbo-remoting-http
- ${project.parent.version}
-
-
- org.apache.dubbo
- dubbo-remoting-netty4
- ${project.parent.version}
-
-
-
- org.apache.dubbo
- dubbo-cluster
- ${project.parent.version}
-
-
-
- org.jboss.resteasy
- resteasy-jaxrs
- provided
-
-
-
- org.jboss.resteasy
- resteasy-client
-
-
-
- javax.validation
- validation-api
-
-
-
-
-
- org.jboss.resteasy
- resteasy-netty4
- provided
-
-
-
- org.jboss.resteasy
- resteasy-jdk-http
- provided
-
-
-
- org.jboss.resteasy
- resteasy-jackson-provider
- provided
-
-
-
- org.jboss.resteasy
- resteasy-jaxb-provider
- provided
-
-
-
-
- io.swagger
- swagger-annotations
-
-
- javax.ws.rs
- jsr311-api
-
-
-
-
- io.swagger
- swagger-jaxrs
-
-
- javax.ws.rs
- jsr311-api
-
-
-
-
-
- org.apache.dubbo
- dubbo-serialization-jdk
- ${project.parent.version}
- test
-
-
-
- org.apache.dubbo
- dubbo-metadata-rest
- ${project.parent.version}
-
-
-
- io.netty
- netty-codec-http
- provided
-
-
-
- io.netty
- netty-transport
- compile
-
-
-
-
- org.springframework
- spring-web
- test
-
-
-
- org.springframework
- spring-context
- test
-
-
-
- com.google.code.gson
- gson
- test
-
-
-
- org.springframework.cloud
- spring-cloud-openfeign-core
- test
-
-
- org.springframework.boot
- spring-boot-starter-logging
-
-
-
-
- org.apache.logging.log4j
- log4j-slf4j-impl
- test
-
-
-
diff --git a/dubbo-rpc/dubbo-rpc-rest/src/main/java/org/apache/dubbo/rpc/protocol/rest/Constants.java b/dubbo-rpc/dubbo-rpc-rest/src/main/java/org/apache/dubbo/rpc/protocol/rest/Constants.java
deleted file mode 100644
index 5aa43155c46..00000000000
--- a/dubbo-rpc/dubbo-rpc-rest/src/main/java/org/apache/dubbo/rpc/protocol/rest/Constants.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * 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;
-
-/**
- * Constants definition.
- */
-public interface Constants {
- String KEEP_ALIVE_KEY = "keepalive";
-
- boolean DEFAULT_KEEP_ALIVE = true;
-
- String EXTENSION_KEY = "extension";
-
- // http server
-
- String NETTY_HTTP = "netty_http";
-}
diff --git a/dubbo-rpc/dubbo-rpc-rest/src/main/java/org/apache/dubbo/rpc/protocol/rest/PathAndInvokerMapper.java b/dubbo-rpc/dubbo-rpc-rest/src/main/java/org/apache/dubbo/rpc/protocol/rest/PathAndInvokerMapper.java
deleted file mode 100644
index bf4bcb225ba..00000000000
--- a/dubbo-rpc/dubbo-rpc-rest/src/main/java/org/apache/dubbo/rpc/protocol/rest/PathAndInvokerMapper.java
+++ /dev/null
@@ -1,184 +0,0 @@
-/*
- * 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;
-
-import org.apache.dubbo.common.logger.ErrorTypeAwareLogger;
-import org.apache.dubbo.common.logger.LoggerFactory;
-import org.apache.dubbo.metadata.rest.PathMatcher;
-import org.apache.dubbo.metadata.rest.RestMethodMetadata;
-import org.apache.dubbo.rpc.Invoker;
-import org.apache.dubbo.rpc.protocol.rest.exception.DoublePathCheckException;
-import org.apache.dubbo.rpc.protocol.rest.pair.InvokerAndRestMethodMetadataPair;
-
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-
-/**
- * save the path & metadata info mapping
- */
-public class PathAndInvokerMapper {
- private static final ErrorTypeAwareLogger logger =
- LoggerFactory.getErrorTypeAwareLogger(PathAndInvokerMapper.class);
-
- private final Map pathToServiceMapContainPathVariable =
- new ConcurrentHashMap<>();
- private final Map pathToServiceMapNoPathVariable =
- new ConcurrentHashMap<>();
-
- // for http method compare 405
- private final Map> pathMatcherToHttpMethodMap = new HashMap<>();
-
- /**
- * deploy path metadata
- *
- * @param metadataMap
- * @param invoker
- */
- public void addPathAndInvoker(Map metadataMap, Invoker invoker) {
-
- metadataMap.entrySet().stream().forEach(entry -> {
- PathMatcher pathMatcher = entry.getKey();
- if (pathMatcher.hasPathVariable()) {
- addPathMatcherToPathMap(
- pathMatcher,
- pathToServiceMapContainPathVariable,
- InvokerAndRestMethodMetadataPair.pair(invoker, entry.getValue()));
- } else {
- addPathMatcherToPathMap(
- pathMatcher,
- pathToServiceMapNoPathVariable,
- InvokerAndRestMethodMetadataPair.pair(invoker, entry.getValue()));
- }
- });
- }
-
- /**
- * get rest method metadata by path matcher
- *
- * @param pathMatcher
- * @return
- */
- public InvokerAndRestMethodMetadataPair getRestMethodMetadata(PathMatcher pathMatcher) {
-
- // first search from pathToServiceMapNoPathVariable
- if (pathToServiceMapNoPathVariable.containsKey(pathMatcher)) {
- return pathToServiceMapNoPathVariable.get(pathMatcher);
- }
-
- // second search from pathToServiceMapContainPathVariable
- if (pathToServiceMapContainPathVariable.containsKey(pathMatcher)) {
- return pathToServiceMapContainPathVariable.get(pathMatcher);
- }
-
- return null;
- }
-
- /**
- * undeploy path metadata
- *
- * @param pathMatcher
- */
- public void removePath(PathMatcher pathMatcher) {
-
- InvokerAndRestMethodMetadataPair containPathVariablePair =
- pathToServiceMapContainPathVariable.remove(pathMatcher);
-
- InvokerAndRestMethodMetadataPair unContainPathVariablePair = pathToServiceMapNoPathVariable.remove(pathMatcher);
- logger.info("dubbo rest undeploy pathMatcher:" + pathMatcher
- + ", and path variable method is :"
- + (containPathVariablePair == null
- ? null
- : containPathVariablePair.getRestMethodMetadata().getReflectMethod())
- + ", and no path variable method is :"
- + (unContainPathVariablePair == null
- ? null
- : unContainPathVariablePair.getRestMethodMetadata().getReflectMethod()));
- }
-
- public void addPathMatcherToPathMap(
- PathMatcher pathMatcher,
- Map pathMatcherPairMap,
- InvokerAndRestMethodMetadataPair invokerRestMethodMetadataPair) {
-
- if (pathMatcherPairMap.containsKey(pathMatcher)) {
-
- // cover the old service metadata when current interface is old interface & current method desc equals
- // old`s method desc,else ,throw double check exception
-
- InvokerAndRestMethodMetadataPair beforeMetadata = pathMatcherPairMap.get(pathMatcher);
- // true when reExport
- if (!invokerRestMethodMetadataPair.compareServiceMethod(beforeMetadata)) {
- throw new DoublePathCheckException("dubbo rest double path check error, current path is: " + pathMatcher
- + " ,and service method is: "
- + invokerRestMethodMetadataPair.getRestMethodMetadata().getReflectMethod()
- + "before service method is: "
- + beforeMetadata.getRestMethodMetadata().getReflectMethod());
- }
- }
-
- pathMatcherPairMap.put(pathMatcher, invokerRestMethodMetadataPair);
-
- addPathMatcherToHttpMethodsMap(pathMatcher);
-
- logger.info("dubbo rest deploy pathMatcher:" + pathMatcher + ", and service method is :"
- + invokerRestMethodMetadataPair.getRestMethodMetadata().getReflectMethod());
- }
-
- private void addPathMatcherToHttpMethodsMap(PathMatcher pathMatcher) {
-
- PathMatcher newPathMatcher = PathMatcher.convertPathMatcher(pathMatcher);
-
- if (!pathMatcherToHttpMethodMap.containsKey(newPathMatcher)) {
- HashSet httpMethods = new HashSet<>();
-
- httpMethods.add(pathMatcher.getHttpMethod());
-
- pathMatcherToHttpMethodMap.put(newPathMatcher, httpMethods);
- }
-
- Set httpMethods = pathMatcherToHttpMethodMap.get(newPathMatcher);
-
- httpMethods.add(newPathMatcher.getHttpMethod());
- }
-
- public boolean isHttpMethodAllowed(PathMatcher pathMatcher) {
-
- PathMatcher newPathMatcher = PathMatcher.convertPathMatcher(pathMatcher);
- if (!pathMatcherToHttpMethodMap.containsKey(newPathMatcher)) {
- return false;
- }
-
- Set httpMethods = pathMatcherToHttpMethodMap.get(newPathMatcher);
-
- return httpMethods.contains(newPathMatcher.getHttpMethod());
- }
-
- public String pathHttpMethods(PathMatcher pathMatcher) {
-
- PathMatcher newPathMatcher = PathMatcher.convertPathMatcher(pathMatcher);
- if (!pathMatcherToHttpMethodMap.containsKey(newPathMatcher)) {
- return null;
- }
-
- Set httpMethods = pathMatcherToHttpMethodMap.get(newPathMatcher);
-
- return httpMethods.toString();
- }
-}
diff --git a/dubbo-rpc/dubbo-rpc-rest/src/main/java/org/apache/dubbo/rpc/protocol/rest/ReferenceCountedClient.java b/dubbo-rpc/dubbo-rpc-rest/src/main/java/org/apache/dubbo/rpc/protocol/rest/ReferenceCountedClient.java
deleted file mode 100644
index b7dbaa0263c..00000000000
--- a/dubbo-rpc/dubbo-rpc-rest/src/main/java/org/apache/dubbo/rpc/protocol/rest/ReferenceCountedClient.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * 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;
-
-import org.apache.dubbo.common.URL;
-import org.apache.dubbo.common.logger.ErrorTypeAwareLogger;
-import org.apache.dubbo.common.logger.LoggerFactory;
-import org.apache.dubbo.common.reference.ReferenceCountedResource;
-import org.apache.dubbo.remoting.http.RestClient;
-import org.apache.dubbo.remoting.http.factory.RestClientFactory;
-
-import java.util.concurrent.ConcurrentMap;
-
-import static org.apache.dubbo.common.constants.LoggerCodeConstants.PROTOCOL_ERROR_CLOSE_CLIENT;
-
-public class ReferenceCountedClient extends ReferenceCountedResource {
- private static final ErrorTypeAwareLogger logger =
- LoggerFactory.getErrorTypeAwareLogger(ReferenceCountedClient.class);
-
- private ConcurrentMap> clients;
- private URL url;
- private RestClientFactory clientFactory;
-
- private T client;
-
- public ReferenceCountedClient(
- T client,
- ConcurrentMap> clients,
- RestClientFactory clientFactory,
- URL url) {
- this.client = client;
- this.clients = clients;
- this.clientFactory = clientFactory;
- this.url = url;
- }
-
- public T getClient() {
-
- // for client destroy and create right now, only lock current client
- synchronized (this) {
- ReferenceCountedClient extends RestClient> referenceCountedClient = clients.get(url.getAddress());
-
- // for double check
- if (referenceCountedClient.isDestroyed()) {
- synchronized (this) {
- referenceCountedClient = clients.get(url.getAddress());
- if (referenceCountedClient.isDestroyed()) {
- RestClient restClient = clientFactory.createRestClient(url);
- clients.put(
- url.getAddress(), new ReferenceCountedClient(restClient, clients, clientFactory, url));
- return (T) restClient;
- } else {
- return (T) referenceCountedClient.client;
- }
- }
-
- } else {
- return client;
- }
- }
- }
-
- public boolean isDestroyed() {
- return client.isClosed();
- }
-
- @Override
- protected void destroy() {
- try {
- client.close();
- } catch (Exception e) {
- logger.error(PROTOCOL_ERROR_CLOSE_CLIENT, "", "", "Close resteasy client error", e);
- }
- }
-}
diff --git a/dubbo-rpc/dubbo-rpc-rest/src/main/java/org/apache/dubbo/rpc/protocol/rest/RestConstraintViolation.java b/dubbo-rpc/dubbo-rpc-rest/src/main/java/org/apache/dubbo/rpc/protocol/rest/RestConstraintViolation.java
deleted file mode 100644
index 6447bff8956..00000000000
--- a/dubbo-rpc/dubbo-rpc-rest/src/main/java/org/apache/dubbo/rpc/protocol/rest/RestConstraintViolation.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * 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;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlRootElement;
-
-import java.io.Serializable;
-
-@XmlRootElement(name = "constraintViolation")
-@XmlAccessorType(XmlAccessType.FIELD)
-public class RestConstraintViolation implements Serializable {
-
- private static final long serialVersionUID = -23497234978L;
-
- private String path;
- private String message;
- private String value;
-
- public RestConstraintViolation(String path, String message, String value) {
- this.path = path;
- this.message = message;
- this.value = value;
- }
-
- public RestConstraintViolation() {}
-
- public String getPath() {
- return path;
- }
-
- public void setPath(String path) {
- this.path = path;
- }
-
- public String getMessage() {
- return message;
- }
-
- public void setMessage(String message) {
- this.message = message;
- }
-
- public String getValue() {
- return value;
- }
-
- public void setValue(String value) {
- this.value = value;
- }
-}
diff --git a/dubbo-rpc/dubbo-rpc-rest/src/main/java/org/apache/dubbo/rpc/protocol/rest/RestHeaderEnum.java b/dubbo-rpc/dubbo-rpc-rest/src/main/java/org/apache/dubbo/rpc/protocol/rest/RestHeaderEnum.java
deleted file mode 100644
index 7eab6db4d6b..00000000000
--- a/dubbo-rpc/dubbo-rpc-rest/src/main/java/org/apache/dubbo/rpc/protocol/rest/RestHeaderEnum.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * 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;
-
-import org.apache.dubbo.rpc.protocol.rest.constans.RestConstant;
-
-public enum RestHeaderEnum {
- CONTENT_TYPE(RestConstant.CONTENT_TYPE),
- ACCEPT(RestConstant.ACCEPT),
- GROUP(RestConstant.REST_HEADER_PREFIX + RestConstant.GROUP),
- VERSION(RestConstant.REST_HEADER_PREFIX + RestConstant.VERSION),
- PATH(RestConstant.REST_HEADER_PREFIX + RestConstant.PATH),
- KEEP_ALIVE_HEADER(RestConstant.KEEP_ALIVE_HEADER),
- CONNECTION(RestConstant.CONNECTION),
- REST_HEADER_PREFIX(RestConstant.REST_HEADER_PREFIX),
- TOKEN_KEY(RestConstant.REST_HEADER_PREFIX + RestConstant.TOKEN_KEY),
- ;
- private final String header;
-
- RestHeaderEnum(String header) {
- this.header = header;
- }
-
- public String getHeader() {
- return header;
- }
-}
diff --git a/dubbo-rpc/dubbo-rpc-rest/src/main/java/org/apache/dubbo/rpc/protocol/rest/RestInvoker.java b/dubbo-rpc/dubbo-rpc-rest/src/main/java/org/apache/dubbo/rpc/protocol/rest/RestInvoker.java
deleted file mode 100644
index 5afb5fecd17..00000000000
--- a/dubbo-rpc/dubbo-rpc-rest/src/main/java/org/apache/dubbo/rpc/protocol/rest/RestInvoker.java
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * 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;
-
-import org.apache.dubbo.common.URL;
-import org.apache.dubbo.metadata.ParameterTypesComparator;
-import org.apache.dubbo.metadata.rest.RestMethodMetadata;
-import org.apache.dubbo.metadata.rest.ServiceRestMetadata;
-import org.apache.dubbo.metadata.rest.media.MediaType;
-import org.apache.dubbo.remoting.http.RequestTemplate;
-import org.apache.dubbo.remoting.http.RestClient;
-import org.apache.dubbo.remoting.http.RestResult;
-import org.apache.dubbo.rpc.AppResponse;
-import org.apache.dubbo.rpc.AsyncRpcResult;
-import org.apache.dubbo.rpc.Invocation;
-import org.apache.dubbo.rpc.Result;
-import org.apache.dubbo.rpc.RpcException;
-import org.apache.dubbo.rpc.protocol.AbstractInvoker;
-import org.apache.dubbo.rpc.protocol.rest.annotation.consumer.HttpConnectionCreateContext;
-import org.apache.dubbo.rpc.protocol.rest.annotation.consumer.HttpConnectionPreBuildIntercept;
-import org.apache.dubbo.rpc.protocol.rest.exception.ParamParseException;
-import org.apache.dubbo.rpc.protocol.rest.exception.PathNoFoundException;
-import org.apache.dubbo.rpc.protocol.rest.exception.RemoteServerInternalException;
-import org.apache.dubbo.rpc.protocol.rest.message.HttpMessageCodecManager;
-import org.apache.dubbo.rpc.protocol.rest.util.HttpHeaderUtil;
-import org.apache.dubbo.rpc.protocol.rest.util.MediaTypeUtil;
-
-import java.lang.reflect.Method;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.CompletableFuture;
-
-public class RestInvoker extends AbstractInvoker {
- private final ServiceRestMetadata serviceRestMetadata;
- private final ReferenceCountedClient extends RestClient> referenceCountedClient;
- private final Set httpConnectionPreBuildIntercepts;
-
- public RestInvoker(
- Class type,
- URL url,
- ReferenceCountedClient extends RestClient> referenceCountedClient,
- Set httpConnectionPreBuildIntercepts,
- ServiceRestMetadata serviceRestMetadata) {
- super(type, url);
- this.serviceRestMetadata = serviceRestMetadata;
- this.referenceCountedClient = referenceCountedClient;
- this.httpConnectionPreBuildIntercepts = httpConnectionPreBuildIntercepts;
- }
-
- @Override
- protected Result doInvoke(Invocation invocation) {
- try {
-
- Map> metadataMap =
- serviceRestMetadata.getMethodToServiceMap();
- // get metadata
- RestMethodMetadata restMethodMetadata = metadataMap
- .get(invocation.getMethodName())
- .get(ParameterTypesComparator.getInstance(invocation.getParameterTypes()));
-
- // create requestTemplate
- RequestTemplate requestTemplate = new RequestTemplate(
- invocation, restMethodMetadata.getRequest().getMethod(), getUrl().getAddress());
-
- HttpConnectionCreateContext httpConnectionCreateContext = createHttpConnectionCreateContext(
- invocation, serviceRestMetadata, restMethodMetadata, requestTemplate);
-
- // fill real data
- for (HttpConnectionPreBuildIntercept intercept : httpConnectionPreBuildIntercepts) {
- intercept.intercept(httpConnectionCreateContext);
- }
-
- // TODO check rest client cannot be reused
- CompletableFuture future =
- referenceCountedClient.getClient().send(requestTemplate);
- CompletableFuture responseFuture = new CompletableFuture<>();
- AsyncRpcResult asyncRpcResult = new AsyncRpcResult(responseFuture, invocation);
- future.whenComplete((r, t) -> {
- if (t != null) {
- responseFuture.completeExceptionally(t);
- } else {
- AppResponse appResponse = new AppResponse();
- try {
- int responseCode = r.getResponseCode();
- MediaType mediaType = MediaType.TEXT_PLAIN;
-
- if (responseCode == 404) {
- responseFuture.completeExceptionally(new PathNoFoundException(r.getMessage()));
- } else if (400 <= responseCode && responseCode < 500) {
- responseFuture.completeExceptionally(new ParamParseException(r.getMessage()));
- // TODO add Exception Mapper
- } else if (responseCode >= 500) {
- responseFuture.completeExceptionally(new RemoteServerInternalException(r.getMessage()));
- } else if (responseCode < 400) {
- Method reflectMethod = restMethodMetadata.getReflectMethod();
- mediaType =
- MediaTypeUtil.convertMediaType(reflectMethod.getReturnType(), r.getContentType());
- Object value = HttpMessageCodecManager.httpMessageDecode(
- r.getBody(),
- reflectMethod.getReturnType(),
- reflectMethod.getGenericReturnType(),
- mediaType);
- appResponse.setValue(value);
- // resolve response attribute & attachment
- HttpHeaderUtil.parseResponseHeader(appResponse, r);
- responseFuture.complete(appResponse);
- }
- } catch (Exception e) {
- responseFuture.completeExceptionally(e);
- }
- }
- });
- return asyncRpcResult;
- } catch (RpcException e) {
- throw e;
- }
- }
-
- /**
- * create intercept context
- *
- * @param invocation
- * @param serviceRestMetadata
- * @param restMethodMetadata
- * @param requestTemplate
- * @return
- */
- private HttpConnectionCreateContext createHttpConnectionCreateContext(
- Invocation invocation,
- ServiceRestMetadata serviceRestMetadata,
- RestMethodMetadata restMethodMetadata,
- RequestTemplate requestTemplate) {
- HttpConnectionCreateContext httpConnectionCreateContext = new HttpConnectionCreateContext();
- httpConnectionCreateContext.setRequestTemplate(requestTemplate);
- httpConnectionCreateContext.setRestMethodMetadata(restMethodMetadata);
- httpConnectionCreateContext.setServiceRestMetadata(serviceRestMetadata);
- httpConnectionCreateContext.setInvocation(invocation);
- httpConnectionCreateContext.setUrl(getUrl());
- return httpConnectionCreateContext;
- }
-}
diff --git a/dubbo-rpc/dubbo-rpc-rest/src/main/java/org/apache/dubbo/rpc/protocol/rest/RestProtocol.java b/dubbo-rpc/dubbo-rpc-rest/src/main/java/org/apache/dubbo/rpc/protocol/rest/RestProtocol.java
deleted file mode 100644
index 3c10fc699ec..00000000000
--- a/dubbo-rpc/dubbo-rpc-rest/src/main/java/org/apache/dubbo/rpc/protocol/rest/RestProtocol.java
+++ /dev/null
@@ -1,278 +0,0 @@
-/*
- * 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;
-
-import org.apache.dubbo.common.URL;
-import org.apache.dubbo.common.utils.ConcurrentHashMapUtils;
-import org.apache.dubbo.common.utils.JsonCompatibilityUtil;
-import org.apache.dubbo.metadata.rest.ServiceRestMetadata;
-import org.apache.dubbo.remoting.api.pu.DefaultPuHandler;
-import org.apache.dubbo.remoting.exchange.PortUnificationExchanger;
-import org.apache.dubbo.remoting.http.RestClient;
-import org.apache.dubbo.remoting.http.factory.RestClientFactory;
-import org.apache.dubbo.rpc.Exporter;
-import org.apache.dubbo.rpc.Invoker;
-import org.apache.dubbo.rpc.ProtocolServer;
-import org.apache.dubbo.rpc.RpcException;
-import org.apache.dubbo.rpc.model.FrameworkModel;
-import org.apache.dubbo.rpc.protocol.AbstractExporter;
-import org.apache.dubbo.rpc.protocol.AbstractProtocol;
-import org.apache.dubbo.rpc.protocol.rest.annotation.consumer.HttpConnectionPreBuildIntercept;
-import org.apache.dubbo.rpc.protocol.rest.annotation.metadata.MetadataResolver;
-import org.apache.dubbo.rpc.protocol.rest.deploy.ServiceDeployer;
-import org.apache.dubbo.rpc.protocol.rest.deploy.ServiceDeployerManager;
-
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-
-import static org.apache.dubbo.common.constants.CommonConstants.INTERFACE_KEY;
-import static org.apache.dubbo.common.constants.CommonConstants.REST_SERVICE_DEPLOYER_URL_ATTRIBUTE_KEY;
-import static org.apache.dubbo.common.constants.LoggerCodeConstants.PROTOCOL_ERROR_CLOSE_CLIENT;
-import static org.apache.dubbo.common.constants.LoggerCodeConstants.PROTOCOL_ERROR_CLOSE_SERVER;
-import static org.apache.dubbo.rpc.protocol.rest.constans.RestConstant.JSON_CHECK_LEVEL;
-import static org.apache.dubbo.rpc.protocol.rest.constans.RestConstant.JSON_CHECK_LEVEL_STRICT;
-import static org.apache.dubbo.rpc.protocol.rest.constans.RestConstant.JSON_CHECK_LEVEL_WARN;
-import static org.apache.dubbo.rpc.protocol.rest.constans.RestConstant.PATH_SEPARATOR;
-
-public class RestProtocol extends AbstractProtocol {
-
- private static final int DEFAULT_PORT = 80;
-
- private final ConcurrentMap> clients =
- new ConcurrentHashMap<>();
-
- private final RestClientFactory clientFactory;
-
- private final Set httpConnectionPreBuildIntercepts;
-
- public RestProtocol(FrameworkModel frameworkModel) {
- this.clientFactory =
- frameworkModel.getExtensionLoader(RestClientFactory.class).getAdaptiveExtension();
- this.httpConnectionPreBuildIntercepts = new LinkedHashSet<>(frameworkModel
- .getExtensionLoader(HttpConnectionPreBuildIntercept.class)
- .getActivateExtensions());
- }
-
- @Override
- public int getDefaultPort() {
- return DEFAULT_PORT;
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public Exporter export(final Invoker invoker) throws RpcException {
- URL url = invoker.getUrl();
- final String uri = serviceKey(url);
- Exporter exporter = (Exporter) exporterMap.get(uri);
- if (exporter != null) {
- // When modifying the configuration through override, you need to re-expose the newly modified service.
- if (Objects.equals(exporter.getInvoker().getUrl(), invoker.getUrl())) {
- return exporter;
- }
- }
-
- // resolve metadata
- ServiceRestMetadata serviceRestMetadata = MetadataResolver.resolveProviderServiceMetadata(
- url.getServiceModel().getProxyObject().getClass(), url, getContextPath(url));
-
- // check json compatibility
- String jsonCheckLevel = url.getUrlParam().getParameter(JSON_CHECK_LEVEL);
- checkJsonCompatibility(invoker.getInterface(), jsonCheckLevel);
-
- // deploy service
- URL newURL = ServiceDeployerManager.deploy(url, serviceRestMetadata, invoker);
-
- // create server
- PortUnificationExchanger.bind(newURL, new DefaultPuHandler());
-
- ServiceDeployer serviceDeployer =
- (ServiceDeployer) newURL.getAttribute(REST_SERVICE_DEPLOYER_URL_ATTRIBUTE_KEY);
-
- URL finalUrl = newURL;
- exporter = new AbstractExporter(invoker) {
- @Override
- public void afterUnExport() {
- destroyInternal(finalUrl);
- exporterMap.remove(uri);
- serviceDeployer.undeploy(serviceRestMetadata);
- }
- };
- exporterMap.put(uri, exporter);
- return exporter;
- }
-
- private void checkJsonCompatibility(Class> clazz, String jsonCheckLevel) throws RpcException {
-
- if (jsonCheckLevel == null || JSON_CHECK_LEVEL_WARN.equals(jsonCheckLevel)) {
- boolean compatibility = JsonCompatibilityUtil.checkClassCompatibility(clazz);
- if (!compatibility) {
- List unsupportedMethods = JsonCompatibilityUtil.getUnsupportedMethods(clazz);
- assert unsupportedMethods != null;
- logger.warn(
- "",
- "",
- "",
- String.format(
- "Interface %s does not support json serialization, the specific methods are %s.",
- clazz.getName(), unsupportedMethods));
- } else {
- logger.debug(
- "Check json compatibility complete, all methods of {} can be serialized using json.",
- clazz.getName());
- }
- } else if (JSON_CHECK_LEVEL_STRICT.equals(jsonCheckLevel)) {
- boolean compatibility = JsonCompatibilityUtil.checkClassCompatibility(clazz);
- if (!compatibility) {
- List unsupportedMethods = JsonCompatibilityUtil.getUnsupportedMethods(clazz);
- assert unsupportedMethods != null;
- throw new IllegalStateException(String.format(
- "Interface %s does not support json serialization, the specific methods are %s.",
- clazz.getName(), unsupportedMethods));
- } else {
- logger.debug(
- "Check json compatibility complete, all methods of {} can be serialized using json.",
- clazz.getName());
- }
- }
- }
-
- @Override
- protected Invoker protocolBindingRefer(final Class type, final URL url) throws RpcException {
-
- ReferenceCountedClient extends RestClient> refClient = clients.get(url.getAddress());
- if (refClient == null || refClient.isDestroyed()) {
- synchronized (clients) {
- refClient = clients.get(url.getAddress());
- if (refClient == null || refClient.isDestroyed()) {
- refClient = ConcurrentHashMapUtils.computeIfAbsent(
- clients, url.getAddress(), _key -> createReferenceCountedClient(url));
- }
- }
- }
- refClient.retain();
-
- String contextPathFromUrl = getContextPath(url);
-
- // resolve metadata
- ServiceRestMetadata serviceRestMetadata =
- MetadataResolver.resolveConsumerServiceMetadata(type, url, contextPathFromUrl);
-
- Invoker invoker =
- new RestInvoker<>(type, url, refClient, httpConnectionPreBuildIntercepts, serviceRestMetadata);
-
- invokers.add(invoker);
- return invoker;
- }
-
- /**
- * create rest ReferenceCountedClient
- *
- * @param url
- * @return
- * @throws RpcException
- */
- private ReferenceCountedClient extends RestClient> createReferenceCountedClient(URL url) throws RpcException {
-
- // url -> RestClient
- RestClient restClient = clientFactory.createRestClient(url);
-
- return new ReferenceCountedClient<>(restClient, clients, clientFactory, url);
- }
-
- @Override
- public void destroy() {
- if (logger.isInfoEnabled()) {
- logger.info("Destroying protocol [" + this.getClass().getSimpleName() + "] ...");
- }
-
- PortUnificationExchanger.close();
- ServiceDeployerManager.close();
-
- super.destroy();
-
- for (Map.Entry entry : serverMap.entrySet()) {
- try {
- if (logger.isInfoEnabled()) {
- logger.info("Closing the rest server at " + entry.getKey());
- }
- entry.getValue().close();
- } catch (Throwable t) {
- logger.warn(PROTOCOL_ERROR_CLOSE_SERVER, "", "", "Error closing rest server", t);
- }
- }
- serverMap.clear();
-
- if (logger.isInfoEnabled()) {
- logger.info("Closing rest clients");
- }
- for (ReferenceCountedClient> client : clients.values()) {
- try {
- // destroy directly regardless of the current reference count.
- client.destroy();
- } catch (Throwable t) {
- logger.warn(PROTOCOL_ERROR_CLOSE_CLIENT, "", "", "Error closing rest client", t);
- }
- }
- clients.clear();
- }
-
- /**
- * getPath() will return: [contextpath + "/" +] path
- * 1. contextpath is empty if user does not set through ProtocolConfig or ProviderConfig
- * 2. path will never be empty, its default value is the interface name.
- *
- * @return return path only if user has explicitly gave then a value.
- */
- private String getContextPath(URL url) {
- String contextPath = url.getPath();
- if (contextPath != null) {
- if (contextPath.equalsIgnoreCase(url.getParameter(INTERFACE_KEY))) {
- return "";
- }
- if (contextPath.endsWith(url.getParameter(INTERFACE_KEY))) {
- contextPath = contextPath.substring(0, contextPath.lastIndexOf(url.getParameter(INTERFACE_KEY)));
- }
- return contextPath.endsWith(PATH_SEPARATOR)
- ? contextPath.substring(0, contextPath.length() - 1)
- : contextPath;
- } else {
- return "";
- }
- }
-
- private void destroyInternal(URL url) {
- try {
- ReferenceCountedClient> referenceCountedClient = clients.get(url.getAddress());
- if (referenceCountedClient != null && referenceCountedClient.release()) {
- clients.remove(url.getAddress());
- }
- } catch (Exception e) {
- logger.warn(
- PROTOCOL_ERROR_CLOSE_CLIENT,
- "",
- "",
- "Failed to close unused resources in rest protocol. interfaceName [" + url.getServiceInterface()
- + "]",
- e);
- }
- }
-}
diff --git a/dubbo-rpc/dubbo-rpc-rest/src/main/java/org/apache/dubbo/rpc/protocol/rest/RestRPCInvocationUtil.java b/dubbo-rpc/dubbo-rpc-rest/src/main/java/org/apache/dubbo/rpc/protocol/rest/RestRPCInvocationUtil.java
deleted file mode 100644
index ffc3b6ec11c..00000000000
--- a/dubbo-rpc/dubbo-rpc-rest/src/main/java/org/apache/dubbo/rpc/protocol/rest/RestRPCInvocationUtil.java
+++ /dev/null
@@ -1,232 +0,0 @@
-/*
- * 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;
-
-import org.apache.dubbo.common.BaseServiceMetadata;
-import org.apache.dubbo.common.logger.ErrorTypeAwareLogger;
-import org.apache.dubbo.common.logger.LoggerFactory;
-import org.apache.dubbo.metadata.rest.ArgInfo;
-import org.apache.dubbo.metadata.rest.PathMatcher;
-import org.apache.dubbo.metadata.rest.RestMethodMetadata;
-import org.apache.dubbo.rpc.Invoker;
-import org.apache.dubbo.rpc.RpcInvocation;
-import org.apache.dubbo.rpc.protocol.rest.annotation.ParamParserManager;
-import org.apache.dubbo.rpc.protocol.rest.annotation.param.parse.provider.ProviderParseContext;
-import org.apache.dubbo.rpc.protocol.rest.deploy.ServiceDeployer;
-import org.apache.dubbo.rpc.protocol.rest.exception.ParamParseException;
-import org.apache.dubbo.rpc.protocol.rest.pair.InvokerAndRestMethodMetadataPair;
-import org.apache.dubbo.rpc.protocol.rest.request.RequestFacade;
-import org.apache.dubbo.rpc.protocol.rest.util.HttpHeaderUtil;
-import org.apache.dubbo.rpc.protocol.rest.util.NoAnnotationBodyParseUtil;
-
-import java.lang.reflect.Method;
-import java.util.Arrays;
-import java.util.List;
-
-public class RestRPCInvocationUtil {
-
- private static final ErrorTypeAwareLogger logger =
- LoggerFactory.getErrorTypeAwareLogger(RestRPCInvocationUtil.class);
-
- /**
- * service method real args parse
- *
- * @param rpcInvocation
- * @param request
- * @param servletRequest
- * @param servletResponse
- * @param restMethodMetadata
- */
- public static void parseMethodArgs(
- RpcInvocation rpcInvocation,
- RequestFacade request,
- Object servletRequest,
- Object servletResponse,
- RestMethodMetadata restMethodMetadata) {
-
- try {
- ProviderParseContext parseContext =
- createParseContext(request, servletRequest, servletResponse, restMethodMetadata);
- Object[] args = ParamParserManager.providerParamParse(parseContext);
-
- List argInfos = parseContext.getArgInfos();
-
- for (ArgInfo argInfo : argInfos) {
- // TODO set default value
- if (argInfo.getParamType().isPrimitive() && args[argInfo.getIndex()] == null) {
- throw new ParamParseException("\n dubbo provider primitive arg not exist in request, method is: "
- + restMethodMetadata.getReflectMethod() + "\n type is: " + argInfo.getParamType()
- + " \n and arg index is: " + argInfo.getIndex());
- }
- }
-
- rpcInvocation.setArguments(args);
- } catch (Exception e) {
- logger.error("", e.getMessage(), "", "dubbo rest provider method args parse error: ", e);
- throw new ParamParseException(e.getMessage());
- }
- }
-
- /**
- * create parseMethodArgs context
- *
- * @param request
- * @param originRequest
- * @param originResponse
- * @param restMethodMetadata
- * @return
- */
- private static ProviderParseContext createParseContext(
- RequestFacade request, Object originRequest, Object originResponse, RestMethodMetadata restMethodMetadata) {
- ProviderParseContext parseContext = new ProviderParseContext(request);
- parseContext.setResponse(originResponse);
- parseContext.setRequest(originRequest);
- parseContext.setNoAnnotationMode(restMethodMetadata.currentCodeStyleIsNoAnnotationMode());
- Object[] objects = new Object[restMethodMetadata.getArgInfos().size()];
- parseContext.setArgs(Arrays.asList(objects));
- parseContext.setArgInfos(restMethodMetadata.getArgInfos());
-
- // parse object arrays body
- if (restMethodMetadata.currentCodeStyleIsNoAnnotationMode()) {
- parseContext.setArrayArgs(NoAnnotationBodyParseUtil.doParse(parseContext));
- }
-
- return parseContext;
- }
-
- /**
- * build RpcInvocation
- *
- * @param request
- * @param restMethodMetadata
- * @return
- */
- public static RpcInvocation createBaseRpcInvocation(RequestFacade request, RestMethodMetadata restMethodMetadata) {
- RpcInvocation rpcInvocation = new RpcInvocation();
-
- rpcInvocation.setParameterTypes(restMethodMetadata.getReflectMethod().getParameterTypes());
- rpcInvocation.setReturnType(restMethodMetadata.getReflectMethod().getReturnType());
- rpcInvocation.setMethodName(restMethodMetadata.getMethod().getName());
-
- // TODO set protocolServiceKey ,but no set method
- //
-
- HttpHeaderUtil.parseRequest(rpcInvocation, request);
-
- String serviceKey = BaseServiceMetadata.buildServiceKey(
- request.getHeader(RestHeaderEnum.PATH.getHeader()),
- request.getHeader(RestHeaderEnum.GROUP.getHeader()),
- request.getHeader(RestHeaderEnum.VERSION.getHeader()));
- rpcInvocation.setTargetServiceUniqueName(serviceKey);
-
- return rpcInvocation;
- }
-
- /**
- * get InvokerAndRestMethodMetadataPair by path matcher
- *
- * @param pathMatcher
- * @return
- */
- public static InvokerAndRestMethodMetadataPair getRestMethodMetadataAndInvokerPair(
- PathMatcher pathMatcher, ServiceDeployer serviceDeployer) {
-
- return serviceDeployer.getPathAndInvokerMapper().getRestMethodMetadata(pathMatcher);
- }
-
- /**
- * get InvokerAndRestMethodMetadataPair from rpc context
- *
- * @param request
- * @return
- */
- public static InvokerAndRestMethodMetadataPair getRestMethodMetadataAndInvokerPair(RequestFacade request) {
-
- PathMatcher pathMather = createPathMatcher(request);
-
- return getRestMethodMetadataAndInvokerPair(pathMather, request.getServiceDeployer());
- }
-
- /**
- * get invoker by request
- *
- * @param request
- * @return
- */
- public static Invoker getInvokerByRequest(RequestFacade request) {
-
- PathMatcher pathMatcher = createPathMatcher(request);
-
- return getInvoker(pathMatcher, request.getServiceDeployer());
- }
-
- /**
- * get invoker by service method
- *
- * compare method`s name,param types
- *
- * @param serviceMethod
- * @return
- */
- public static Invoker getInvokerByServiceInvokeMethod(Method serviceMethod, ServiceDeployer serviceDeployer) {
-
- if (serviceMethod == null) {
- return null;
- }
-
- PathMatcher pathMatcher = PathMatcher.getInvokeCreatePathMatcher(serviceMethod);
-
- InvokerAndRestMethodMetadataPair pair = getRestMethodMetadataAndInvokerPair(pathMatcher, serviceDeployer);
-
- if (pair == null) {
- return null;
- }
-
- return pair.getInvoker();
- }
-
- /**
- * get invoker by path matcher
- *
- * @param pathMatcher
- * @return
- */
- public static Invoker getInvoker(PathMatcher pathMatcher, ServiceDeployer serviceDeployer) {
- InvokerAndRestMethodMetadataPair pair = getRestMethodMetadataAndInvokerPair(pathMatcher, serviceDeployer);
-
- if (pair == null) {
- return null;
- }
-
- return pair.getInvoker();
- }
-
- /**
- * create path matcher by request
- *
- * @param request
- * @return
- */
- public static PathMatcher createPathMatcher(RequestFacade request) {
- String path = request.getPath();
- String version = request.getHeader(RestHeaderEnum.VERSION.getHeader());
- String group = request.getHeader(RestHeaderEnum.GROUP.getHeader());
- String method = request.getMethod();
-
- return PathMatcher.getInvokeCreatePathMatcher(path, version, group, null, method);
- }
-}
diff --git a/dubbo-rpc/dubbo-rpc-rest/src/main/java/org/apache/dubbo/rpc/protocol/rest/RpcExceptionMapper.java b/dubbo-rpc/dubbo-rpc-rest/src/main/java/org/apache/dubbo/rpc/protocol/rest/RpcExceptionMapper.java
deleted file mode 100644
index 6336f1cf548..00000000000
--- a/dubbo-rpc/dubbo-rpc-rest/src/main/java/org/apache/dubbo/rpc/protocol/rest/RpcExceptionMapper.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * 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;
-
-import org.apache.dubbo.common.utils.ClassUtils;
-import org.apache.dubbo.rpc.RpcException;
-import org.apache.dubbo.rpc.protocol.rest.exception.mapper.ExceptionHandler;
-import org.apache.dubbo.rpc.protocol.rest.util.ConstraintViolationExceptionConvert;
-
-public class RpcExceptionMapper implements ExceptionHandler {
-
- @Override
- public Object result(RpcException e) {
-
- // javax dependency judge
- if (violationDependency()) {
- // ConstraintViolationException judge
- if (ConstraintViolationExceptionConvert.needConvert(e)) {
- return ConstraintViolationExceptionConvert.handleConstraintViolationException(e);
- }
- }
-
- return "Internal server error: " + e.getMessage();
- }
-
- private boolean violationDependency() {
- return ClassUtils.isPresent(
- "javax.validation.ConstraintViolationException", RpcExceptionMapper.class.getClassLoader());
- }
-}
diff --git a/dubbo-rpc/dubbo-rpc-rest/src/main/java/org/apache/dubbo/rpc/protocol/rest/ViolationReport.java b/dubbo-rpc/dubbo-rpc-rest/src/main/java/org/apache/dubbo/rpc/protocol/rest/ViolationReport.java
deleted file mode 100644
index fcf7faf5f57..00000000000
--- a/dubbo-rpc/dubbo-rpc-rest/src/main/java/org/apache/dubbo/rpc/protocol/rest/ViolationReport.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * 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;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlRootElement;
-
-import java.io.Serializable;
-import java.util.LinkedList;
-import java.util.List;
-
-@XmlRootElement(name = "violationReport")
-@XmlAccessorType(XmlAccessType.FIELD)
-public class ViolationReport implements Serializable {
-
- private static final long serialVersionUID = -130498234L;
-
- private List constraintViolations;
-
- public List getConstraintViolations() {
- return constraintViolations;
- }
-
- public void setConstraintViolations(List constraintViolations) {
- this.constraintViolations = constraintViolations;
- }
-
- public void addConstraintViolation(RestConstraintViolation constraintViolation) {
- if (constraintViolations == null) {
- constraintViolations = new LinkedList<>();
- }
- constraintViolations.add(constraintViolation);
- }
-}
diff --git a/dubbo-rpc/dubbo-rpc-rest/src/main/java/org/apache/dubbo/rpc/protocol/rest/annotation/BaseParseContext.java b/dubbo-rpc/dubbo-rpc-rest/src/main/java/org/apache/dubbo/rpc/protocol/rest/annotation/BaseParseContext.java
deleted file mode 100644
index e5de8f8e513..00000000000
--- a/dubbo-rpc/dubbo-rpc-rest/src/main/java/org/apache/dubbo/rpc/protocol/rest/annotation/BaseParseContext.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * 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.annotation;
-
-import org.apache.dubbo.metadata.rest.ArgInfo;
-
-import java.util.List;
-
-public class BaseParseContext {
-
- protected List