You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by GitBox <gi...@apache.org> on 2021/04/23 08:27:43 UTC

[GitHub] [servicecomb-java-chassis] tiger-super opened a new issue #2359: standalone和servlet两种模式下的HttpServerFilter

tiger-super opened a new issue #2359:
URL: https://github.com/apache/servicecomb-java-chassis/issues/2359


   我实现了一个HttpServerFilter,主要抽取部分报文的数据放入context。
   ![image](https://user-images.githubusercontent.com/32871618/115842381-5a0be500-a450-11eb-8435-0facd01add5a.png)
   在standalone是可以正常获取到请求报文
   ![image](https://user-images.githubusercontent.com/32871618/115842702-ab1bd900-a450-11eb-9516-d8ad170c8a5b.png)
   但在servlet获取的报文却为null
   ![image](https://user-images.githubusercontent.com/32871618/115842744-b53dd780-a450-11eb-82ec-9c595abbb4b4.png)
   请问在servlet是要如何实现


-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [servicecomb-java-chassis] liubao68 commented on issue #2359: standalone和servlet两种模式下的HttpServerFilter

Posted by GitBox <gi...@apache.org>.
liubao68 commented on issue #2359:
URL: https://github.com/apache/servicecomb-java-chassis/issues/2359#issuecomment-826187681


   这种用户会破坏java-chassis的设计约束,接口定义和实际客户请求不一致。 这个不属于产品支持的使用范围了,需要开发者自行根据版本迭代和测试确保正确性,里面的实现可能会发生变化。 通常来讲, body是只读的,在处理过程中修改他的值的处理方式是不可靠的。


-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [servicecomb-java-chassis] liubao68 commented on issue #2359: standalone和servlet两种模式下的HttpServerFilter

Posted by GitBox <gi...@apache.org>.
liubao68 commented on issue #2359:
URL: https://github.com/apache/servicecomb-java-chassis/issues/2359#issuecomment-825499459


   实现 httpServerFileter的时候,注意实现 `needCacheRequest` 方法, 返回 true。 servlet的流只能读取一次,需要显示的缓存,避免多次读取。 


-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [servicecomb-java-chassis] liubao68 commented on issue #2359: standalone和servlet两种模式下的HttpServerFilter

Posted by GitBox <gi...@apache.org>.
liubao68 commented on issue #2359:
URL: https://github.com/apache/servicecomb-java-chassis/issues/2359#issuecomment-826187681


   这种用户会破坏java-chassis的设计约束,接口定义和实际客户请求不一致。 这个不属于产品支持的使用范围了,需要开发者自行根据版本迭代和测试确保正确性,里面的实现可能会发生变化。 通常来讲, body是只读的,在处理过程中修改他的值的处理方式是不可靠的。


-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [servicecomb-java-chassis] tiger-super commented on issue #2359: standalone和servlet两种模式下的HttpServerFilter

Posted by GitBox <gi...@apache.org>.
tiger-super commented on issue #2359:
URL: https://github.com/apache/servicecomb-java-chassis/issues/2359#issuecomment-825546377


   > 实现 httpServerFileter的时候,注意实现 `needCacheRequest` 方法, 返回 true,并显示的读取流 `getInputSteam`,然后流的内容会缓存到bodyBuffer里面。 servlet的流只能读取一次,需要显示的缓存,避免多次读取。
   
   请问一下这个报文怎么改,因为是发过来的是xml我想转成json格式,目前我是这样实现,发现不行controller接收到还是xml
   ![image](https://user-images.githubusercontent.com/32871618/115854969-59c61680-a45d-11eb-9c35-eecc6b3c77f4.png)
   


-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [servicecomb-java-chassis] liubao68 edited a comment on issue #2359: standalone和servlet两种模式下的HttpServerFilter

Posted by GitBox <gi...@apache.org>.
liubao68 edited a comment on issue #2359:
URL: https://github.com/apache/servicecomb-java-chassis/issues/2359#issuecomment-825499459


   实现 httpServerFileter的时候,注意实现 `needCacheRequest` 方法, 返回 true,并显示的读取流 `getInputSteam`,然后流的内容会缓存到bodyBuffer里面。 servlet的流只能读取一次,需要显示的缓存,避免多次读取。 


-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org