Spring Cloud Gateway无法处理带有“ ==”的参数的Post请求,如何处理?

时间:2019-01-19 08:27:38

标签: java spring spring-cloud spring-cloud-gateway

我在Spring Cloud项目中将Spring Cloud网关用作API网关

我发现,如果发布请求的参数具有“ ==”,则响应将具有以下警告:

 "error": "Internal Server Error",

    "message": "Invalid character '=' for QUERY_PARAM in \"%7B%22businessType%22:%22ftTranslate%22,%22command%22:%22sentence%22,%22data%22:%20%7B%22origin%22:%22zh%22,%22target%22:%22en%22,%22udid%22:%22%22%7D,%22tcl%22:%20%7B%22clientId%22:%221a5bf636-34ca-4aec-8bca-08d2a276ada1%22,%22subSysId%22:9,%22token%22:%22ua_73g+Qkl/nSMb7oPiqiwofOxrWnVp9zXWqMZ2FNT0Yam6Fv5zbQioS3I9+ws7WBPHGF/aVHHpMeC/g7L7BM/xWX/ghCZRLlzwmvDPA7SZnDUlbLOzGyxaXg==%22%7D,%22version%22:%221.0.0%22%7D\""

服务器日志

��java.lang.IllegalArgumentException:“%7B%22businessType%22:%22ftTranslate%22,%22command%22:%22sentence%22,%22data%22:%20%”中的QUERY_PARAM的无效字符'=' 7B%22origin%22:%22zh%22,%22target%22:%22en%22,%22udid%22:%22%22%7D,%22tcl%22:%20%7B%22clientId%22:%221a5bf636- 34ca-4aec-8bca-08d2a276ada1%22%22subSysId%22:9,%22token%22:%22ua_73g + QKL / nSMb7oPiqiwofOxrWnVp9zXWqMZ2FNT0Yam6Fv5zbQioS3I9 + ws7WBPHGF / aVHHpMeC / g7L7BM / xWX / ghCZRLlzwmvDPA7SZnDUlbLOzGyxaXg ==%22%22source%22:%22app org.springframework.web.util.HierarchicalUriComponents.verifyUriComponent(HierarchicalUriComponents.java:333)的[%22%7D,%22version%22:%221.0.0%22%7D“〜[spring-web-5.0.7.RELEASE。 jar:5.0.7.RELEASE],位于org.springframework.web.util.HierarchicalUriComponents.lambda $ verify $ 2(HierarchicalUriComponents.java:301)〜[spring-web-5.0.7.RELEASE.jar:5.0.7.RELEASE]在java.util.Map.forEach(Map.java:630)〜[na:1.8.0_191]在org.springframework.web.util.HierarchicalUriComponents.verify(HierarchicalUriComponent s.java:298)〜[spri ng-web-5.0.7.RELEASE.jar:5.0.7.RELEASE] 在org.springframework.web.util.HierarchicalUriComponents。(HierarchicalUriComponents.java:100)〜[spring-web-5.0.7.RELEASE.jar:5.0.7.RELEASE] 在org.springframework.web.util.UriComponentsBuilder.build(UriComponentsBuilder.java:345)〜[spring-web-5.0.7.RELEASE.jar:5.0.7.RELEASE] 在org.springframework.cloud.gateway.filter.RouteToRequestUrlFilter.filter(RouteToRequestUrlFilter.java:73)〜[spring-cloud-gateway-core-2.0.0.RELEASE.jar:2.0.0.RELEASE] 在org.springframework.cloud.gateway.handler.FilteringWebHandler $ GatewayFilterAdapter.filter(FilteringWebHandler.java:133)〜[spring-cloud-gateway-core-2.0.0.RELEASE.jar:2.0.0.RELEASE] 在org.springframework.cloud.gateway.filter.OrderedGatewayFilter.filter(OrderedGatewayFilter.java:44)〜[spring-cloud-gateway-core-2.0.0.RELEASE.jar:2.0.0.RELEASE] 在org.springframework.cloud.gateway.handler.FilteringWebHandler $ DefaultGatewayFilterChain.lambda $ filter $ 0(FilteringWebHandler.java:115)〜[spring-cloud-gateway-core-2.0.0.RELEASE.jar:2.0.0.RELEASE] 在react..core.publisher.MonoDefer.subscribe(MonoDefer.java:45)〜[reactor-core-3.1.8.RELEASE.jar:3.1.8.RELEASE] 在Reactor.core.publisher.MonoDefer.subscribe(MonoDefer.java:53)〜[reactor-core-3.1.8.RELEASE.jar:3.1.8.RELEASE] 在Reactor.core.publisher.MonoDefer.subscribe(MonoDefer.java:53)〜[reactor-core-3.1.8.RELEASE.jar:3.1.8.RELEASE] 在Reactor.core.publisher.Mono.subscribe(Mono.java:3080)〜[reactor-core-3.1.8.RELEASE.jar:3.1.8.RELEASE] 在react..core.publisher.MonoIgnoreThen $ ThenIgnoreMain.drain(MonoIgnoreThen.java:172)〜[reactor-core-3.1.8.RELEASE.jar:3.1.8.RELEASE] 在Reactor.core.publisher.MonoIgnoreThen.subscribe(MonoIgnoreThen.java:56)〜[reactor-core-3.1.8.RELEASE.jar:3.1.8.RELEASE] 在Reactor.core.publisher.MonoDefer.subscribe(MonoDefer.java:53)〜[reactor-core-3.1.8.RELEASE.jar:3.1.8.RELEASE] 在Reactor.core.publisher.MonoDefer.subscribe(MonoDefer.java:53)〜[reactor-core-3.1.8.RELEASE.jar:3.1.8.RELEASE] 在Reactor.core.publisher.Mono.subscribe(Mono.java:3080)〜[reactor-core-3.1.8.RELEASE.jar:3.1.8.RELEASE] 在react..core.publisher.MonoIgnoreThen $ ThenIgnoreMain.drain(MonoIgnoreThen.java:172)〜[reactor-core-3.1.8.RELEASE.jar:3.1.8.RELEASE] 在Reactor.core.publisher.MonoIgnoreThen.subscribe(MonoIgnoreThen.java:56)〜[reactor-core-3.1.8.RELEASE.jar:3.1.8.RELEASE] 在Reactor.core.publisher.MonoFlatMap $ FlatMapMain.onNext(MonoFlatMap.java:150)〜[reactor-core-3.1.8.RELEASE.jar:3.1.8.RELEASE] 在Reactor.core.publisher.FluxSwitchIfEmpty $ SwitchIfEmptySubscriber.onNext(FluxSwitchIfEmpty.java:67)〜[reactor-core-3.1.8.RELEASE.jar:3.1.8.RELEASE] 在Reactor.core.publisher.MonoNext $ NextSubscriber.onNext(MonoNext.java:76)〜[reactor-core-3.1.8.RELEASE.jar:3.1.8.RELEASE] 在Reactor.core.publisher.FluxConcatMap $ ConcatMapImmediate.innerNext(FluxConcatMap.java:271)〜[reactor-core-3.1.8.RELEASE.jar:3.1.8.RELEASE] 在react..core.publisher.FluxConcatMap $ ConcatMapInner.onNext(FluxConcatMap.java:803)〜[reactor-core-3.1.8.RELEASE.jar:3.1.8.RELEASE] 在react..core.publisher.FluxMap $ MapSubscriber.onNext(FluxMap.java:108)〜[reactor-core-3.1.8.RELEASE.jar:3.1.8.RELEASE] 在Reactor.core.publisher.FluxSwitchIfEmpty $ SwitchIfEmptySubscriber.onNext(FluxSwitchIfEmpty.java:67)〜[reactor-core-3.1.8.RELEASE.jar:3.1.8.RELEASE] 在Reactor.core.publisher.Operators $ MonoSubscriber.complete(Operators.java:1083)〜[reactor-core-3.1.8.RELEASE.jar:3.1.8.RELEASE] 在Reactor.core.publisher.MonoFlatMap $ FlatMapMain.onNext(MonoFlatMap.java:144)〜[reactor-core-3.1.8.RELEASE.jar:3.1.8.RELEASE] 在react..core.publisher.FluxMap $ MapSubscriber.onNext(FluxMap.java:108)〜[reactor-core-3.1.8.RELEASE.jar:3.1.8.RELEASE] 在Reactor.core.publisher.MonoNext $ NextSubscriber.onNext(MonoNext.java:76)〜[reactor-core-3.1.8.RELEASE.jar:3.1.8.RELEASE] 在Reactor.core.publisher.FluxFilterWhen $ FluxFilterWhenSubscriber.drain(FluxFilterWhen.java:262)〜[reactor-core-3.1.8.RELEASE.jar:3.1.8.RELEASE] 在react..core.publisher.FluxFilterWhen $ FluxFilterWhenSubscriber.onNext(FluxFilterWhen.java:131)〜[reactor-core-3.1.8.RELEASE.jar:3.1.8.RELEASE] 在Reactor.core.publisher.DrainUtils.postCompleteDrainDelayError(DrainUtils.java:296)〜[reactor-core-3.1.8.RELEASE.jar:3.1.8.RELEASE] 在Reactor.core.publisher.DrainUtils.postCompleteDelayError(DrainUtils.java:357)〜[reactor-core-3.1.8.RELEASE.jar:3.1.8.RELEASE] 在react.core.publisher.FluxDematerialize $ DematerializeSubscriber.onComplete(FluxDematerialize.java:144)〜[reactor-core-3.1.8.RELEASE.jar:3.1.8.RELEASE] 在react.core.publisher.FluxDematerialize $ DematerializeSubscriber.onNext(FluxDematerialize.java:102)〜[reactor-core-3.1.8.RELEASE.jar:3.1.8.RELEASE] 在react.core.publisher.FluxDematerialize $ DematerializeSubscriber.onNext(FluxDematerialize.java:42)〜[reactor-core-3.1.8.RELEASE.jar:3.1.8.RELEASE] 在Reactor.core.publisher.FluxFlattenIterable $ FlattenIterableSubscriber.drainAsync(FluxFlattenIterable.java:391)〜[reactor-core-3.1.8.RELEASE.jar:3.1.8.RELEASE] 在reactor.core.pu

该如何处理?谢谢

0 个答案:

没有答案