Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
touzizhuo03
Dubbo
提交
abb58106
D
Dubbo
项目概览
touzizhuo03
/
Dubbo
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
Dubbo
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
abb58106
编写于
4月 06, 2018
作者:
Y
YunaiV
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
spring http invoker
上级
b24e7026
变更
14
隐藏空白更改
内联
并排
Showing
14 changed file
with
364 addition
and
1 deletion
+364
-1
dubbo-demo/dubbo-demo-api/src/main/java/com/alibaba/dubbo/demo/HttpDemoService.java
...src/main/java/com/alibaba/dubbo/demo/HttpDemoService.java
+7
-0
dubbo-demo/dubbo-http-demo-consumer/pom.xml
dubbo-demo/dubbo-http-demo-consumer/pom.xml
+86
-0
dubbo-demo/dubbo-http-demo-consumer/src/main/java/com/alibaba/dubbo/demo/provider/Main.java
...r/src/main/java/com/alibaba/dubbo/demo/provider/Main.java
+29
-0
dubbo-demo/dubbo-http-demo-consumer/src/main/resources/META-INF/spring/dubbo-demo-provider.xml
...rc/main/resources/META-INF/spring/dubbo-demo-provider.xml
+41
-0
dubbo-demo/dubbo-http-demo-consumer/src/main/resources/dubbo.properties
...bo-http-demo-consumer/src/main/resources/dubbo.properties
+9
-0
dubbo-demo/dubbo-http-demo-consumer/src/main/resources/log4j.properties
...bo-http-demo-consumer/src/main/resources/log4j.properties
+7
-0
dubbo-demo/dubbo-http-demo-provider/pom.xml
dubbo-demo/dubbo-http-demo-provider/pom.xml
+64
-0
dubbo-demo/dubbo-http-demo-provider/src/main/java/com/alibaba/dubbo/demo/provider/DemoServiceImpl.java
...java/com/alibaba/dubbo/demo/provider/DemoServiceImpl.java
+28
-0
dubbo-demo/dubbo-http-demo-provider/src/main/java/com/alibaba/dubbo/demo/provider/HttpProvider.java
...in/java/com/alibaba/dubbo/demo/provider/HttpProvider.java
+33
-0
dubbo-demo/dubbo-http-demo-provider/src/main/resources/META-INF/spring/dubbo-demo-provider.xml
...rc/main/resources/META-INF/spring/dubbo-demo-provider.xml
+41
-0
dubbo-demo/dubbo-http-demo-provider/src/main/resources/dubbo.properties
...bo-http-demo-provider/src/main/resources/dubbo.properties
+9
-0
dubbo-demo/dubbo-http-demo-provider/src/main/resources/log4j.properties
...bo-http-demo-provider/src/main/resources/log4j.properties
+7
-0
dubbo-demo/pom.xml
dubbo-demo/pom.xml
+2
-0
dubbo-rpc/dubbo-rpc-http/src/main/java/com/alibaba/dubbo/rpc/protocol/http/HttpProtocol.java
...ava/com/alibaba/dubbo/rpc/protocol/http/HttpProtocol.java
+1
-1
未找到文件。
dubbo-demo/dubbo-demo-api/src/main/java/com/alibaba/dubbo/demo/HttpDemoService.java
0 → 100644
浏览文件 @
abb58106
package
com.alibaba.dubbo.demo
;
public
interface
HttpDemoService
{
String
hello
(
String
msg
);
}
dubbo-demo/dubbo-http-demo-consumer/pom.xml
0 → 100644
浏览文件 @
abb58106
<!--
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.
-->
<project
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xmlns=
"http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"
>
<modelVersion>
4.0.0
</modelVersion>
<parent>
<groupId>
com.alibaba
</groupId>
<artifactId>
dubbo-demo
</artifactId>
<version>
2.6.1
</version>
</parent>
<artifactId>
dubbo-http-demo-consumer
</artifactId>
<packaging>
jar
</packaging>
<name>
${project.artifactId}
</name>
<description>
The demo provider module of dubbo project
</description>
<properties>
<skip_maven_deploy>
true
</skip_maven_deploy>
</properties>
<dependencies>
<dependency>
<groupId>
com.alibaba
</groupId>
<artifactId>
dubbo-demo-api
</artifactId>
<version>
${project.parent.version}
</version>
</dependency>
<dependency>
<groupId>
com.alibaba
</groupId>
<artifactId>
dubbo-config-spring
</artifactId>
</dependency>
<dependency>
<groupId>
com.alibaba
</groupId>
<artifactId>
dubbo-registry-zookeeper
</artifactId>
</dependency>
<dependency>
<groupId>
com.alibaba
</groupId>
<artifactId>
dubbo-registry-multicast
</artifactId>
</dependency>
<dependency>
<groupId>
com.alibaba
</groupId>
<artifactId>
dubbo-cluster
</artifactId>
</dependency>
<!--<dependency>-->
<!--<groupId>com.alibaba</groupId>-->
<!--<artifactId>dubbo-rpc-http</artifactId>-->
<!--</dependency>-->
<!--<dependency>-->
<!--<groupId>com.alibaba</groupId>-->
<!--<artifactId>dubbo-remoting-http</artifactId>-->
<!--</dependency>-->
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-web
</artifactId>
<version>
1.5.10.RELEASE
</version>
<exclusions>
<exclusion>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-tomcat
</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>
org.slf4j
</groupId>
<artifactId>
slf4j-api
</artifactId>
<version>
1.7.25
</version>
</dependency>
<dependency>
<groupId>
org.slf4j
</groupId>
<artifactId>
slf4j-log4j12
</artifactId>
<version>
1.7.25
</version>
</dependency>
</dependencies>
</project>
\ No newline at end of file
dubbo-demo/dubbo-http-demo-consumer/src/main/java/com/alibaba/dubbo/demo/provider/Main.java
0 → 100644
浏览文件 @
abb58106
package
com.alibaba.dubbo.demo.provider
;
import
com.alibaba.dubbo.demo.HttpDemoService
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean
;
@Configuration
public
class
Main
{
// http://www.baeldung.com/spring-remoting-http-invoker
@Bean
public
HttpInvokerProxyFactoryBean
invoker
()
{
HttpInvokerProxyFactoryBean
invoker
=
new
HttpInvokerProxyFactoryBean
();
invoker
.
setServiceUrl
(
"http://192.168.3.17:8080/com.alibaba.dubbo.demo.HttpDemoService"
);
invoker
.
setServiceInterface
(
HttpDemoService
.
class
);
return
invoker
;
}
public
static
void
main
(
String
[]
args
)
{
HttpDemoService
service
=
SpringApplication
.
run
(
Main
.
class
,
args
)
.
getBean
(
HttpDemoService
.
class
);
System
.
out
.
println
(
"666:"
+
service
.
hello
(
"123"
));
}
}
dubbo-demo/dubbo-http-demo-consumer/src/main/resources/META-INF/spring/dubbo-demo-provider.xml
0 → 100644
浏览文件 @
abb58106
<?xml version="1.0" encoding="UTF-8"?>
<!--
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.
-->
<beans
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xmlns:dubbo=
"http://code.alibabatech.com/schema/dubbo"
xmlns=
"http://www.springframework.org/schema/beans"
xsi:schemaLocation=
"http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd"
>
<!-- provider's application name, used for tracing dependency relationship -->
<dubbo:application
name=
"demo-provider"
/>
<dubbo:provider
delay=
"-1"
retries=
"0"
/>
<dubbo:registry
address=
"zookeeper://127.0.0.1:2181"
/>
<bean
id=
"demoService"
class=
"com.alibaba.dubbo.demo.provider.DemoServiceImpl"
/>
<!-- declare the service interface to be exported -->
<dubbo:service
interface=
"com.alibaba.dubbo.demo.HttpDemoService"
ref=
"demoService"
>
</dubbo:service>
<!-- use dubbo protocol to export service on port 20880 -->
<dubbo:protocol
name=
"http"
port=
"8080"
server=
"tomcat"
/>
<!--<dubbo:protocol id="pb" name="dubbo" port="20881"/>-->
</beans>
\ No newline at end of file
dubbo-demo/dubbo-http-demo-consumer/src/main/resources/dubbo.properties
0 → 100644
浏览文件 @
abb58106
dubbo.application.qos.port
=
22222
dubbo.registry.address
=
192.168.0.1
# serviceA
#dubbo.service.sa.version=1.2.3
#dubbo.service.sa.protocols=pa,pb
# serviceB
#
dubbo.service.sb.version
=
1.2.4
\ No newline at end of file
dubbo-demo/dubbo-http-demo-consumer/src/main/resources/log4j.properties
0 → 100644
浏览文件 @
abb58106
###set log levels###
log4j.rootLogger
=
info, stdout
###output to the console###
log4j.appender.stdout
=
org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target
=
System.out
log4j.appender.stdout.layout
=
org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern
=
[%d{dd/MM/yy hh:mm:ss:sss z}] %t %5p %c{2}: %m%n
\ No newline at end of file
dubbo-demo/dubbo-http-demo-provider/pom.xml
0 → 100644
浏览文件 @
abb58106
<!--
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.
-->
<project
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xmlns=
"http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"
>
<modelVersion>
4.0.0
</modelVersion>
<parent>
<groupId>
com.alibaba
</groupId>
<artifactId>
dubbo-demo
</artifactId>
<version>
2.6.1
</version>
</parent>
<artifactId>
dubbo-http-demo-provider
</artifactId>
<packaging>
jar
</packaging>
<name>
${project.artifactId}
</name>
<description>
The demo provider module of dubbo project
</description>
<properties>
<skip_maven_deploy>
true
</skip_maven_deploy>
</properties>
<dependencies>
<dependency>
<groupId>
com.alibaba
</groupId>
<artifactId>
dubbo-demo-api
</artifactId>
<version>
${project.parent.version}
</version>
</dependency>
<dependency>
<groupId>
com.alibaba
</groupId>
<artifactId>
dubbo-config-spring
</artifactId>
</dependency>
<dependency>
<groupId>
com.alibaba
</groupId>
<artifactId>
dubbo-registry-zookeeper
</artifactId>
</dependency>
<dependency>
<groupId>
com.alibaba
</groupId>
<artifactId>
dubbo-registry-multicast
</artifactId>
</dependency>
<dependency>
<groupId>
com.alibaba
</groupId>
<artifactId>
dubbo-cluster
</artifactId>
</dependency>
<dependency>
<groupId>
com.alibaba
</groupId>
<artifactId>
dubbo-rpc-http
</artifactId>
</dependency>
<dependency>
<groupId>
com.alibaba
</groupId>
<artifactId>
dubbo-remoting-http
</artifactId>
</dependency>
</dependencies>
</project>
\ No newline at end of file
dubbo-demo/dubbo-http-demo-provider/src/main/java/com/alibaba/dubbo/demo/provider/DemoServiceImpl.java
0 → 100644
浏览文件 @
abb58106
/*
* 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.demo.provider
;
import
com.alibaba.dubbo.demo.HttpDemoService
;
public
class
DemoServiceImpl
implements
HttpDemoService
{
@Override
public
String
hello
(
String
msg
)
{
return
"response:"
+
msg
;
}
}
\ No newline at end of file
dubbo-demo/dubbo-http-demo-provider/src/main/java/com/alibaba/dubbo/demo/provider/HttpProvider.java
0 → 100644
浏览文件 @
abb58106
/*
* 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.demo.provider
;
import
org.springframework.context.support.ClassPathXmlApplicationContext
;
public
class
HttpProvider
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
//Prevent to get IPV6 address,this way only work in debug mode
//But you can pass use -Djava.net.preferIPv4Stack=true,then it work well whether in debug mode or not
System
.
setProperty
(
"java.net.preferIPv4Stack"
,
"true"
);
ClassPathXmlApplicationContext
context
=
new
ClassPathXmlApplicationContext
(
new
String
[]{
"META-INF/spring/dubbo-demo-provider.xml"
});
context
.
start
();
System
.
in
.
read
();
// press any key to exit
}
}
dubbo-demo/dubbo-http-demo-provider/src/main/resources/META-INF/spring/dubbo-demo-provider.xml
0 → 100644
浏览文件 @
abb58106
<?xml version="1.0" encoding="UTF-8"?>
<!--
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.
-->
<beans
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xmlns:dubbo=
"http://code.alibabatech.com/schema/dubbo"
xmlns=
"http://www.springframework.org/schema/beans"
xsi:schemaLocation=
"http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd"
>
<!-- provider's application name, used for tracing dependency relationship -->
<dubbo:application
name=
"demo-provider"
/>
<dubbo:provider
delay=
"-1"
retries=
"0"
/>
<dubbo:registry
address=
"zookeeper://127.0.0.1:2181"
/>
<bean
id=
"demoService"
class=
"com.alibaba.dubbo.demo.provider.DemoServiceImpl"
/>
<!-- declare the service interface to be exported -->
<dubbo:service
interface=
"com.alibaba.dubbo.demo.HttpDemoService"
ref=
"demoService"
>
</dubbo:service>
<!-- use dubbo protocol to export service on port 20880 -->
<dubbo:protocol
name=
"http"
port=
"8080"
server=
"tomcat"
/>
<!--<dubbo:protocol id="pb" name="dubbo" port="20881"/>-->
</beans>
\ No newline at end of file
dubbo-demo/dubbo-http-demo-provider/src/main/resources/dubbo.properties
0 → 100644
浏览文件 @
abb58106
dubbo.application.qos.port
=
22222
dubbo.registry.address
=
192.168.0.1
# serviceA
#dubbo.service.sa.version=1.2.3
#dubbo.service.sa.protocols=pa,pb
# serviceB
#
dubbo.service.sb.version
=
1.2.4
\ No newline at end of file
dubbo-demo/dubbo-http-demo-provider/src/main/resources/log4j.properties
0 → 100644
浏览文件 @
abb58106
###set log levels###
log4j.rootLogger
=
info, stdout
###output to the console###
log4j.appender.stdout
=
org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target
=
System.out
log4j.appender.stdout.layout
=
org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern
=
[%d{dd/MM/yy hh:mm:ss:sss z}] %t %5p %c{2}: %m%n
\ No newline at end of file
dubbo-demo/pom.xml
浏览文件 @
abb58106
...
...
@@ -34,6 +34,8 @@ limitations under the License.
<module>
dubbo-demo-provider
</module>
<module>
dubbo-demo-consumer
</module>
<module>
dubbo-demo-injvm
</module>
<module>
dubbo-http-demo-provider
</module>
<module>
dubbo-http-demo-consumer
</module>
</modules>
<dependencyManagement>
...
...
dubbo-rpc/dubbo-rpc-http/src/main/java/com/alibaba/dubbo/rpc/protocol/http/HttpProtocol.java
浏览文件 @
abb58106
...
...
@@ -109,7 +109,7 @@ public class HttpProtocol extends AbstractProxyProtocol {
HttpComponentsHttpInvokerRequestExecutor
httpInvokerRequestExecutor
=
new
HttpComponentsHttpInvokerRequestExecutor
();
httpInvokerRequestExecutor
.
setReadTimeout
(
url
.
getParameter
(
Constants
.
CONNECT_TIMEOUT_KEY
,
Constants
.
DEFAULT_CONNECT_TIMEOUT
));
httpProxyFactoryBean
.
setHttpInvokerRequestExecutor
(
httpInvokerRequestExecutor
);
}
else
if
(
client
!=
null
&&
client
.
length
()
>
0
)
{
}
else
{
throw
new
IllegalStateException
(
"Unsupported http protocol client "
+
client
+
", only supported: simple, commons"
);
}
httpProxyFactoryBean
.
afterPropertiesSet
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录