From 45ceebc34ba121c2d04d9f2d7ec9d92e99a1a1a3 Mon Sep 17 00:00:00 2001 From: tanghc Date: Thu, 20 Aug 2020 11:38:38 +0800 Subject: [PATCH] 4.0.3 --- doc/docs/files/90100_常见问题.md | 53 +--------------------------- 1 file changed, 1 insertion(+), 52 deletions(-) diff --git a/doc/docs/files/90100_常见问题.md b/doc/docs/files/90100_常见问题.md index c852eb15..7ab7489a 100644 --- a/doc/docs/files/90100_常见问题.md +++ b/doc/docs/files/90100_常见问题.md @@ -1,10 +1,5 @@ # 常见问题 -## 在zuul过滤器中获取请求参数 - -```java -ApiParam param = ZuulContext.getApiParam(); -``` ## 在SpringCloudGateway中获取请求参数 @@ -15,41 +10,15 @@ ApiParam apiParam = ServerWebExchangeUtil.getApiParam(exchange); ## 微服务端如何获取appId等参数 ```java -OpenContext openContext = ServiceContext.getCurrentContext().getOpenContext(); -String appId = openContext.getAppId(); +String app_id = request.getParameter("app_id"); ``` -## 在其它地方获取业务参数 - -```java -OpenContext openContext = ServiceContext.getCurrentContext().getOpenContext(); -Story bizObject = (Story)openContext.getBizObject(); - -或 - -OpenContext openContext = ServiceContext.getCurrentContext().getOpenContext(); -Story bizObject = openContext.getBizObject(Story.class); -``` ## 如何关闭签名验证 - 针对某一个接口关闭签名验证 `@Open(value = "alipay.story.get", ignoreValidate = true)` -- 针对所有接口关闭签名验证 - -```java -@Configuration -public class ZuulConfig extends AlipayZuulConfiguration { - - static { - ... - ApiConfig.getInstance().setIgnoreValidate(true); - ... - } - -} -``` ## 注册到eureka显示hostname,非ip @@ -103,26 +72,6 @@ yml添加: ribbon.ReadTimeout= 60000 ``` -## 指定了context-path(拉取路由404) - -微服务项目定义了`server.servlet.context-path=/story-service`,同时必须指定: - -```properties -spring.cloud.nacos.discovery.metadata.context-path=${server.servlet.context-path} -``` - -yml配置如下: - -```yaml -spring: - cloud: - nacos: - discovery: - metadata: - context-path: ${server.servlet.context-path} -``` - -不然网关无法拉取路由信息 ## 其它微服务没有开放接口,需要排除