template method 2 -> 1
This commit is contained in:
parent
45d50dff39
commit
908fb65894
@ -82,22 +82,17 @@ public class ContextInfo {
|
||||
private UserInfoMap userInfoMap;
|
||||
|
||||
/**
|
||||
* 模板方法1,从外部输入的request来构建自定义的ContextInfo
|
||||
* @param request
|
||||
*/
|
||||
public void buildCustomInfoByRequest(HttpServletRequest request) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 模板方法2,从内部pudge的返回值UserInfoMap来构建自定义的ContextInfo
|
||||
* 模板方法,用来自定义ContextInfo。
|
||||
*
|
||||
* @param httpRequest, 从外部输入的request
|
||||
* @param userInfoMap pudge /user 这个auth api返回的所有的KV内容
|
||||
*/
|
||||
public void buildCustomInfoByUserInfoMap(UserInfoMap userInfoMap){
|
||||
this.userInfoMap = userInfoMap;
|
||||
public void buildCustomInfo(HttpServletRequest httpRequest, UserInfoMap infoMap) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param <T> 每个独立部署的服务,都有自己的UserContext类,这里输入这个类。
|
||||
@ -156,4 +151,5 @@ public class ContextInfo {
|
||||
.ipAddress(this.systemAndDeviceInfo.getIpAddress())
|
||||
.build();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -90,8 +90,7 @@ public class ContextInfoBuilderAspect {
|
||||
buildContextInfoByRemoteAuthResponse(contextInfo, authResultJson);
|
||||
|
||||
// 定制一些信息的处理
|
||||
contextInfo.buildCustomInfoByRequest(httpRequest);
|
||||
contextInfo.buildCustomInfoByUserInfoMap(contextInfo.getUserInfoMap());
|
||||
contextInfo.buildCustomInfo(httpRequest, contextInfo.getUserInfoMap());
|
||||
|
||||
// 把ContextInfo放到ThreadLocal中
|
||||
ContextInfoHolder.set(contextInfo);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user