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 2020/01/04 08:19:21 UTC

[GitHub] [servicecomb-java-chassis] sunjinghan7331 commented on issue #1509: 为什么在过滤器中,无法向HTTP请求头添加参数?

sunjinghan7331 commented on issue #1509: 为什么在过滤器中,无法向HTTP请求头添加参数?
URL: https://github.com/apache/servicecomb-java-chassis/issues/1509#issuecomment-570766745
 
 
   可以使用invocation这个参数进行传递.
   在过滤器的afterReceiveRequest()方法中,将你要传递的header参数使用
   invocation.addContext(Constants.DEVELOPER_UID, “123456”);
   的方式进行包装,然后在Controller中使用
   public Response logout(InvocationContext context) {
           String value = context.getContext(Constants.DEVELOPER_UID);
           return null;
       }
   即可获取到值。

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


With regards,
Apache Git Services