You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shenyu.apache.org by GitBox <gi...@apache.org> on 2022/07/04 05:53:57 UTC

[GitHub] [incubator-shenyu] gongzhibo opened a new issue, #3660: [Question] The body data is truncated</h1><pre> gongzhibo opened a new issue, #3660: URL: https://github.com/apache/incubator-shenyu/issues/3660 ### Question ![tiXyVwKcAL](https://user-images.githubusercontent.com/19222385/177089800-fd2586ac-6416-46e4-bc66-9df1bc37eaed.jpg) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscribe@shenyu.apache.org.apache.org For queries about this service, please contact Infrastructure at: users@infra.apache.org </pre><hr/> <h2>[GitHub] [incubator-shenyu] moremind commented on issue #3660: [Question] <title>when body is too long,the body data is truncated,why?</h2> <b>Posted by GitBox <gi...@apache.org>.</b><hr/><pre> moremind commented on issue #3660: URL: https://github.com/apache/incubator-shenyu/issues/3660#issuecomment-1173532977 in `org.apache.shenyu.plugin.base.RpcParamTransformPlugin` make sure that ```java private Mono<Void> body(final ServerWebExchange exchange, final ServerHttpRequest serverHttpRequest, final ShenyuPluginChain chain) { return Mono.from(DataBufferUtils.join(serverHttpRequest.getBody()) .flatMap(body -> { exchange.getAttributes().put(Constants.PARAM_TRANSFORM, resolveBodyFromRequest(body)); return chain.execute(exchange); })); } ``` this is look like https://github.com/apache/incubator-shenyu/issues/3158 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscribe@shenyu.apache.org For queries about this service, please contact Infrastructure at: users@infra.apache.org </pre><hr/> <h2>[GitHub] [incubator-shenyu] gongzhibo commented on issue #3660: [Question] <title>when body is too long,the body data is truncated,why?</h2> <b>Posted by GitBox <gi...@apache.org>.</b><hr/><pre> gongzhibo commented on issue #3660: URL: https://github.com/apache/incubator-shenyu/issues/3660#issuecomment-1173586729 > > > > in `org.apache.shenyu.plugin.base.RpcParamTransformPlugin` make sure that > > > > ```java > > > > private Mono<Void> body(final ServerWebExchange exchange, final ServerHttpRequest serverHttpRequest, final ShenyuPluginChain chain) { > > > > return Mono.from(DataBufferUtils.join(serverHttpRequest.getBody()) > > > > .flatMap(body -> { > > > > exchange.getAttributes().put(Constants.PARAM_TRANSFORM, resolveBodyFromRequest(body)); > > > > return chain.execute(exchange); > > > > })); > > > > } > > > > ``` > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > this is look like #3158 > > > > > > > > > Yes, how to reassign the size of the Databuffer in this place > > > > > > not reassign, data buffer is 1024, you can use `return Mono.from(DataBufferUtils.join(serverHttpRequest.getBody())` -> `DataBufferUtils.join()` collect data buffer. > > make sure your code same to above code. the same private Mono<Void> body(final ServerWebExchange exchange, final ServerHttpRequest serverHttpRequest, final ShenyuPluginChain chain) { return Mono.from(serverHttpRequest.getBody() .flatMap(body -> { exchange.getAttributes().put(Constants.PARAM_TRANSFORM, resolveBodyFromRequest(body)); return chain.execute(exchange); })); } private String resolveBodyFromRequest(final DataBuffer dataBuffer) { byte[] bytes = new byte[dataBuffer.readableByteCount()]; dataBuffer.read(bytes); DataBufferUtils.release(dataBuffer); return new String(bytes, StandardCharsets.UTF_8); } -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscribe@shenyu.apache.org For queries about this service, please contact Infrastructure at: users@infra.apache.org </pre><hr/> <h2>[GitHub] [incubator-shenyu] moremind commented on issue #3660: [Question] <title>when body is too long,the body data is truncated,why?</h2> <b>Posted by GitBox <gi...@apache.org>.</b><hr/><pre> moremind commented on issue #3660: URL: https://github.com/apache/incubator-shenyu/issues/3660#issuecomment-1173601706 ``` private Mono<Void> body(final ServerWebExchange exchange, final ServerHttpRequest serverHttpRequest, final ShenyuPluginChain chain) { return Mono.from(serverHttpRequest.getBody() .flatMap(body -> { exchange.getAttributes().put(Constants.PARAM_TRANSFORM, resolveBodyFromRequest(body)); return chain.execute(exchange); })); } ``` this code not same to ``` private Mono<Void> body(final ServerWebExchange exchange, final ServerHttpRequest serverHttpRequest, final ShenyuPluginChain chain) { return Mono.from(DataBufferUtils.join(serverHttpRequest.getBody()) .flatMap(body -> { exchange.getAttributes().put(Constants.PARAM_TRANSFORM, resolveBodyFromRequest(body)); return chain.execute(exchange); })); } ``` second code have `DataBufferUtils#join` method, it keep data intactly. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscribe@shenyu.apache.org For queries about this service, please contact Infrastructure at: users@infra.apache.org </pre><hr/> <h2>[GitHub] [incubator-shenyu] gongzhibo commented on issue #3660: [Question] <title>when body is too long,the body data is truncated,why?</h2> <b>Posted by GitBox <gi...@apache.org>.</b><hr/><pre> gongzhibo commented on issue #3660: URL: https://github.com/apache/incubator-shenyu/issues/3660#issuecomment-1173527326 version:2.4.2 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscribe@shenyu.apache.org For queries about this service, please contact Infrastructure at: users@infra.apache.org </pre><hr/> <h2>[GitHub] [incubator-shenyu] moremind commented on issue #3660: [Question] <title>when body is too long,the body data is truncated,why?</h2> <b>Posted by GitBox <gi...@apache.org>.</b><hr/><pre> moremind commented on issue #3660: URL: https://github.com/apache/incubator-shenyu/issues/3660#issuecomment-1173547904 > > in `org.apache.shenyu.plugin.base.RpcParamTransformPlugin` make sure that > > ```java > > private Mono<Void> body(final ServerWebExchange exchange, final ServerHttpRequest serverHttpRequest, final ShenyuPluginChain chain) { > > return Mono.from(DataBufferUtils.join(serverHttpRequest.getBody()) > > .flatMap(body -> { > > exchange.getAttributes().put(Constants.PARAM_TRANSFORM, resolveBodyFromRequest(body)); > > return chain.execute(exchange); > > })); > > } > > ``` > > > > > > > > > > > > > > > > > > > > > > > > this is look like #3158 > > Yes, how to reassign the size of the Databuffer in this place not reassign, data buffer is 1024, you can use `return Mono.from(DataBufferUtils.join(serverHttpRequest.getBody())` -> `DataBufferUtils.join()` collect data buffer. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscribe@shenyu.apache.org For queries about this service, please contact Infrastructure at: users@infra.apache.org </pre><hr/> <h2>[GitHub] [incubator-shenyu] gongzhibo commented on issue #3660: [Question] <title>when body is too long,the body data is truncated,why?</h2> <b>Posted by GitBox <gi...@apache.org>.</b><hr/><pre> gongzhibo commented on issue #3660: URL: https://github.com/apache/incubator-shenyu/issues/3660#issuecomment-1173539697 > Check this in `GeneralContextPlugin` This plug-in GeneralContextPluginis not used -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscribe@shenyu.apache.org For queries about this service, please contact Infrastructure at: users@infra.apache.org </pre><hr/> <h2>[GitHub] [incubator-shenyu] KevinClair closed issue #3660: [Question] <title>when body is too long,the body data is truncated,why?</h2> <b>Posted by GitBox <gi...@apache.org>.</b><hr/><pre> KevinClair closed issue #3660: [Question] <title>when body is too long,the body data is truncated,why? URL: https://github.com/apache/incubator-shenyu/issues/3660 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscribe@shenyu.apache.org For queries about this service, please contact Infrastructure at: users@infra.apache.org </pre><hr/> <h2>[GitHub] [incubator-shenyu] gongzhibo commented on issue #3660: [Question] <title>when body is too long,the body data is truncated,why?</h2> <b>Posted by GitBox <gi...@apache.org>.</b><hr/><pre> gongzhibo commented on issue #3660: URL: https://github.com/apache/incubator-shenyu/issues/3660#issuecomment-1173615312 > DataBufferUtils.join Thank you very much. It has been solved -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscribe@shenyu.apache.org For queries about this service, please contact Infrastructure at: users@infra.apache.org </pre><hr/> <h2>[GitHub] [incubator-shenyu] moremind commented on issue #3660: [Question] <title>when body is too long,the body data is truncated,why?</h2> <b>Posted by GitBox <gi...@apache.org>.</b><hr/><pre> moremind commented on issue #3660: URL: https://github.com/apache/incubator-shenyu/issues/3660#issuecomment-1173450918 ShenYu Version? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscribe@shenyu.apache.org For queries about this service, please contact Infrastructure at: users@infra.apache.org </pre><hr/> <h2>[GitHub] [incubator-shenyu] KevinClair commented on issue #3660: [Question] <title>when body is too long,the body data is truncated,why?</h2> <b>Posted by GitBox <gi...@apache.org>.</b><hr/><pre> KevinClair commented on issue #3660: URL: https://github.com/apache/incubator-shenyu/issues/3660#issuecomment-1173520117 Check this in `GeneralContextPlugin` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscribe@shenyu.apache.org For queries about this service, please contact Infrastructure at: users@infra.apache.org </pre><hr/> <h2>[GitHub] [incubator-shenyu] moremind commented on issue #3660: [Question] <title>when body is too long,the body data is truncated,why?</h2> <b>Posted by GitBox <gi...@apache.org>.</b><hr/><pre> moremind commented on issue #3660: URL: https://github.com/apache/incubator-shenyu/issues/3660#issuecomment-1173548437 > > > in `org.apache.shenyu.plugin.base.RpcParamTransformPlugin` make sure that > > > ```java > > > private Mono<Void> body(final ServerWebExchange exchange, final ServerHttpRequest serverHttpRequest, final ShenyuPluginChain chain) { > > > return Mono.from(DataBufferUtils.join(serverHttpRequest.getBody()) > > > .flatMap(body -> { > > > exchange.getAttributes().put(Constants.PARAM_TRANSFORM, resolveBodyFromRequest(body)); > > > return chain.execute(exchange); > > > })); > > > } > > > ``` > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > this is look like #3158 > > > > > > Yes, how to reassign the size of the Databuffer in this place > > not reassign, data buffer is 1024, you can use `return Mono.from(DataBufferUtils.join(serverHttpRequest.getBody())` -> `DataBufferUtils.join()` collect data buffer. make sure your code same to above code. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscribe@shenyu.apache.org For queries about this service, please contact Infrastructure at: users@infra.apache.org </pre><hr/> <h2>[GitHub] [incubator-shenyu] gongzhibo commented on issue #3660: [Question] <title>when body is too long,the body data is truncated,why?</h2> <b>Posted by GitBox <gi...@apache.org>.</b><hr/><pre> gongzhibo commented on issue #3660: URL: https://github.com/apache/incubator-shenyu/issues/3660#issuecomment-1173539180 > in `org.apache.shenyu.plugin.base.RpcParamTransformPlugin` make sure that > > ```java > private Mono<Void> body(final ServerWebExchange exchange, final ServerHttpRequest serverHttpRequest, final ShenyuPluginChain chain) { > return Mono.from(DataBufferUtils.join(serverHttpRequest.getBody()) > .flatMap(body -> { > exchange.getAttributes().put(Constants.PARAM_TRANSFORM, resolveBodyFromRequest(body)); > return chain.execute(exchange); > })); > } > ``` > > this is look like #3158 Yes, how to reassign the size of the Databuffer in this place -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscribe@shenyu.apache.org For queries about this service, please contact Infrastructure at: users@infra.apache.org </pre><hr/> </body> </html>