You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shenyu.apache.org by xi...@apache.org on 2022/01/12 04:02:35 UTC

[incubator-shenyu-website] branch main updated: guide chinese docs (#438)

This is an automated email from the ASF dual-hosted git repository.

xiaoyu pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-shenyu-website.git


The following commit(s) were added to refs/heads/main by this push:
     new 41b2f59  guide chinese docs (#438)
41b2f59 is described below

commit 41b2f59733095be9153a43ac32b055364d96736b
Author: likeguo <33...@users.noreply.github.com>
AuthorDate: Wed Jan 12 12:02:27 2022 +0800

    guide chinese docs (#438)
---
 docs/quick-start/quick-start-http.md               |  4 +-
 docs/user-guide/http-proxy.md                      |  2 +-
 docs/user-guide/spring-cloud-proxy.md              |  2 +-
 .../current/quick-start/quick-start-http.md        |  7 ++
 .../current/quick-start/quick-start-springcloud.md | 39 +++++++++-
 .../current/user-guide/http-proxy.md               | 55 ++++++++++++++
 .../current/user-guide/spring-cloud-proxy.md       | 83 ++++++++++++++++++++++
 7 files changed, 187 insertions(+), 5 deletions(-)

diff --git a/docs/quick-start/quick-start-http.md b/docs/quick-start/quick-start-http.md
index 2485c7b..59a982b 100644
--- a/docs/quick-start/quick-start-http.md
+++ b/docs/quick-start/quick-start-http.md
@@ -69,10 +69,10 @@ Use PostMan to simulate HTTP to request your http service:
 
 ![](/img/shenyu/quick-start/http/postman-test.png)
 
-Use IDEA HTTP Client Plugin to simulate HTTP to request your SpringCloud service[local:no Shenyu proxy]:
+Use IDEA HTTP Client Plugin to simulate HTTP to request your http service[local:no Shenyu proxy]:
 
 ![](/img/shenyu/quick-start/http/idea-http-test-local.png)
 
-Use IDEA HTTP Client Plugin to simulate HTTP to request your SpringCloud service[Shenyu proxy]:
+Use IDEA HTTP Client Plugin to simulate HTTP to request your http service[Shenyu proxy]:
 
 ![](/img/shenyu/quick-start/http/idea-http-test-proxy.png)
diff --git a/docs/user-guide/http-proxy.md b/docs/user-guide/http-proxy.md
index 1916f4a..5918666 100644
--- a/docs/user-guide/http-proxy.md
+++ b/docs/user-guide/http-proxy.md
@@ -165,7 +165,7 @@ The following indicates that `/order/save` is proxied by the gateway, while `/or
 ```
 
 example (3):This is a simplified way to use it, just need a simple annotation to register to the gateway using metadata.
-Special note: currently only supports @RequestMapping, @GetMapping, @PostMapping, @DeleteMapping, @PutMapping annotations, and only valid for the first path in @XXXMapping
+Special note: currently only supports `@RequestMapping, @GetMapping, @PostMapping, @DeleteMapping, @PutMapping` annotations, and only valid for the first path in `@XXXMapping`
 
 ```java
   @RestController
diff --git a/docs/user-guide/spring-cloud-proxy.md b/docs/user-guide/spring-cloud-proxy.md
index a79d54f..678db0d 100644
--- a/docs/user-guide/spring-cloud-proxy.md
+++ b/docs/user-guide/spring-cloud-proxy.md
@@ -221,7 +221,7 @@ shenyu:
 ```
 
 example (4):This is a simplified way to use it, just need a simple annotation to register to the gateway using metadata.
-Special note: currently only supports @RequestMapping, @GetMapping, @PostMapping, @DeleteMapping, @PutMapping annotations, and only valid for the first path in @XXXMapping
+Special note: currently only supports `@RequestMapping, @GetMapping, @PostMapping, @DeleteMapping, @PutMapping` annotations, and only valid for the first path in `@XXXMapping`.
 
 ```java
   @RestController
diff --git a/i18n/zh/docusaurus-plugin-content-docs/current/quick-start/quick-start-http.md b/i18n/zh/docusaurus-plugin-content-docs/current/quick-start/quick-start-http.md
index 13cc345..31e9d61 100644
--- a/i18n/zh/docusaurus-plugin-content-docs/current/quick-start/quick-start-http.md
+++ b/i18n/zh/docusaurus-plugin-content-docs/current/quick-start/quick-start-http.md
@@ -70,3 +70,10 @@ description: Http快速开始
 
 ![](/img/shenyu/quick-start/http/postman-test.png)
 
+下面使用`IDEA HTTP Client Plugin`模拟`http`的方式来请求你的`http`服务[本地访问,不使用`shenyu`代理]:
+
+![](/img/shenyu/quick-start/http/idea-http-test-local.png)
+
+下面使用`IDEA HTTP Client Plugin`模拟`http`的方式来请求你的`http`服务[使用`shenyu`代理]:
+
+![](/img/shenyu/quick-start/http/idea-http-test-proxy.png)
diff --git a/i18n/zh/docusaurus-plugin-content-docs/current/quick-start/quick-start-springcloud.md b/i18n/zh/docusaurus-plugin-content-docs/current/quick-start/quick-start-springcloud.md
index cea6514..12757f3 100644
--- a/i18n/zh/docusaurus-plugin-content-docs/current/quick-start/quick-start-springcloud.md
+++ b/i18n/zh/docusaurus-plugin-content-docs/current/quick-start/quick-start-springcloud.md
@@ -51,7 +51,7 @@ description: Spring Cloud快速开始
 
 `eureka`配置信息如下:
 
-```xml
+```yml
 eureka:
   client:
     serviceUrl:
@@ -60,6 +60,35 @@ eureka:
     prefer-ip-address: true
 ```
 
+特别注意: 请保证`springCloud`注册中心服务发现配置为开启
+
+* 配置方式
+
+```yml
+spring:
+  cloud:
+    discovery:
+      enabled: true
+```
+
+* 代码方式
+
+```java
+@SpringBootApplication
+@EnableDiscoveryClient
+public class ShenyuBootstrapApplication {
+    
+    /**
+     * Main Entrance.
+     *
+     * @param args startup arguments
+     */
+    public static void main(final String[] args) {
+        SpringApplication.run(ShenyuBootstrapApplication.class, args);
+    }
+}
+```
+
 启动`shenyu-bootstrap`项目。
 
 ## 运行shenyu-examples-springcloud
@@ -123,3 +152,11 @@ eureka:
 下面使用`postman`模拟`http`的方式来请求你的`SpringCloud`服务:
 
 ![](/img/shenyu/quick-start/springcloud/postman-test.png)
+
+使用 `IDEA HTTP Client` 插件模拟`http`的方式来请求你的`SpringCloud`服务[本地访问,不使用`shenyu`代理]:
+
+![](/img/shenyu/quick-start/springcloud/idea-http-test-local.png)
+
+使用 `IDEA HTTP Client` 插件模拟`http`的方式来请求你的`SpringCloud`服务[使用`shenyu`代理]:
+
+![](/img/shenyu/quick-start/springcloud/idea-http-test-proxy.png)
diff --git a/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/http-proxy.md b/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/http-proxy.md
index d076be1..47529dd 100644
--- a/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/http-proxy.md
+++ b/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/http-proxy.md
@@ -159,6 +159,61 @@ description: Http服务接入
   }
 ```
 
+示例三:这是一种简化的使用方式,只需要一个简单的注释即可使用元数据注册到网关.
+特别说明:目前只支持`@RequestMapping、@GetMapping、@PostMapping、@DeleteMapping、@PutMapping`注解,并且只对`@XXXMapping`中的第一个路径有效
+
+```java
+  @RestController
+  @RequestMapping("new/feature")
+  public class NewFeatureController {
+  
+    /**
+     * no support gateway access api.
+     *
+     * @return result
+     */
+    @RequestMapping("/gateway/not")
+    public EntityResult noSupportGateway() {
+      return new EntityResult(200, "no support gateway access");
+    }
+  
+    /**
+     * Do not use shenyu annotation path. used request mapping path.
+     *
+     * @return result
+     */
+    @RequestMapping("/requst/mapping/path")
+    @ShenyuSpringCloudClient
+    public EntityResult requestMappingUrl() {
+      return new EntityResult(200, "Do not use shenyu annotation path. used request mapping path");
+    }
+  
+    /**
+     * Do not use shenyu annotation path. used post mapping path.
+     *
+     * @return result
+     */
+    @PostMapping("/post/mapping/path")
+    @ShenyuSpringCloudClient
+    public EntityResult postMappingUrl() {
+      return new EntityResult(200, "Do not use shenyu annotation path. used post mapping path");
+    }
+  
+    /**
+     * Do not use shenyu annotation path. used post mapping path.
+     *
+     * @return result
+     */
+    @GetMapping("/get/mapping/path")
+    @ShenyuSpringCloudClient
+    public EntityResult getMappingUrl() {
+      return new EntityResult(200, "Do not use shenyu annotation path. used get mapping path");
+    }
+  }
+
+```
+
+
 * 启动你的项目,你的服务接口接入到了网关,进入`shenyu-admin`后台管理系统的`插件列表 -> http process -> divide`,看到自动创建的选择器和规则。
 
 ## Http请求接入网关(其他语言,非springMvc体系)
diff --git a/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/spring-cloud-proxy.md b/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/spring-cloud-proxy.md
index 2f7e915..72324f4 100644
--- a/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/spring-cloud-proxy.md
+++ b/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/spring-cloud-proxy.md
@@ -83,6 +83,35 @@ description: SpringCloud接入ShenYu网关
              server-addr: 127.0.0.1:8848 # 你的nacos地址
    ```
 
+特别提示:请确保spring Cloud注册中心服务发现配置开启
+
+* 配置方式
+
+```yml
+spring:
+  cloud:
+    discovery:
+      enabled: true
+```
+
+* 代码方式
+
+```java
+@SpringBootApplication
+@EnableDiscoveryClient
+public class ShenyuBootstrapApplication {
+    
+    /**
+     * Main Entrance.
+     *
+     * @param args startup arguments
+     */
+    public static void main(final String[] args) {
+        SpringApplication.run(ShenyuBootstrapApplication.class, args);
+    }
+}
+```
+
 * 重启你的网关服务。
 
 ## SpringCloud服务接入网关
@@ -196,6 +225,60 @@ shenyu:
 ```
 
 
+示例四:这是一种简化的使用方式,只需要一个简单的注解,使用元数据注册到网关。
+特别说明:目前只支持`@RequestMapping、@GetMapping、@PostMapping、@DeleteMapping、@PutMapping`注解,并且只对`@XXXMapping`中的第一个路径有效。
+
+```java
+  @RestController
+  @RequestMapping("new/feature")
+  public class NewFeatureController {
+  
+    /**
+     * no support gateway access api.
+     *
+     * @return result
+     */
+    @RequestMapping("/gateway/not")
+    public EntityResult noSupportGateway() {
+      return new EntityResult(200, "no support gateway access");
+    }
+  
+    /**
+     * Do not use shenyu annotation path. used request mapping path.
+     *
+     * @return result
+     */
+    @RequestMapping("/requst/mapping/path")
+    @ShenyuSpringCloudClient
+    public EntityResult requestMappingUrl() {
+      return new EntityResult(200, "Do not use shenyu annotation path. used request mapping path");
+    }
+  
+    /**
+     * Do not use shenyu annotation path. used post mapping path.
+     *
+     * @return result
+     */
+    @PostMapping("/post/mapping/path")
+    @ShenyuSpringCloudClient
+    public EntityResult postMappingUrl() {
+      return new EntityResult(200, "Do not use shenyu annotation path. used post mapping path");
+    }
+  
+    /**
+     * Do not use shenyu annotation path. used post mapping path.
+     *
+     * @return result
+     */
+    @GetMapping("/get/mapping/path")
+    @ShenyuSpringCloudClient
+    public EntityResult getMappingUrl() {
+      return new EntityResult(200, "Do not use shenyu annotation path. used get mapping path");
+    }
+  }
+
+```
+
 * 启动你的服务成功注册后,进入后台管理系统的`插件列表 -> rpc proxy -> springCloud`,会看到自动注册的选择器和规则信息。