soiz-tor opened a new issue, #11725:
URL: https://github.com/apache/dubbo/issues/11725
```
环境:
jdk:19
dubbo:3.2.0.beta-5
```
```
这是我的dubbo过滤器
@Activate(group = CommonConstants.CONSUMER, value = "cookieValidationFilter")
public class CookieValidationFilter implements Filter {
@Override
public Result invoke(Invoker<?> invoker, Invocation invocation) throws
RpcException {
RpcContext context = RpcContext.getServerContext();
return invoker.invoke(invocation);
}
}
```
```
这是我的controller:
@DubboReference(protocol = "tri")
UserService userService;
@PostMapping(value = "/sign_in", consumes =
MediaType.APPLICATION_FORM_URLENCODED_VALUE)
public ServerResponseEntity<Object> loginController(ServerHttpRequest
serverHttpRequest, ServerHttpResponse serverHttpResponse) {
RpcContext context = RpcContext.getServerContext();
System.out.println("rest接口");
System.out.println(context.getProtocol());
System.out.println(context.getRemoteAddressString());
System.out.println("-----------------------------------------");
String userInfo = serverHttpRequest.getHeaders().getFirst(USERINFO);
ServerResponseEntity<Object> responseEntity =
userService.loginService(userInfo);
serverHttpResponse.addCookie(ResponseCookie.from("COOKIE_ID",
String.valueOf(responseEntity.getData())).build());
return responseEntity;
}
```
```
这是我的service:
@Override
public ServerResponseEntity<Object> loginService(String userInfo) {
try {
responseEntity = new ServerResponseEntity<>(0, "login success!",
Decryptor.decrypt(userInfo));
} catch (Exception e) {
logger.info(e.toString());
}
return responseEntity;
}
```
```
这是打印结果:
这是客户端连续两次调用/sign_in的打印结果
rest接口
null
null:0
-----------------------------------------
rest接口
tri
null:0
-----------------------------------------
```
问:为什么前后两次协议打印结果不一样,第一次null,第二次是tri
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]