mirror of https://gitee.com/stylefeng/roses
【7.3.0】更新配置监听设置
parent
8076ceae65
commit
227a4401e3
|
@ -33,19 +33,23 @@ import cn.stylefeng.roses.kernel.auth.api.cookie.SessionCookieCreator;
|
|||
import cn.stylefeng.roses.kernel.auth.api.expander.AuthConfigExpander;
|
||||
import cn.stylefeng.roses.kernel.auth.api.pojo.login.LoginUser;
|
||||
import cn.stylefeng.roses.kernel.cache.api.CacheOperatorApi;
|
||||
import cn.stylefeng.roses.kernel.message.api.expander.WebSocketConfigExpander;
|
||||
import cn.stylefeng.roses.kernel.rule.callback.ConfigUpdateCallback;
|
||||
import cn.stylefeng.roses.kernel.rule.util.HttpServletUtil;
|
||||
|
||||
import javax.servlet.http.Cookie;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.*;
|
||||
|
||||
import static cn.stylefeng.roses.kernel.message.api.constants.MessageConstants.WEB_SOCKET_WS_URL_CONFIG_CODE;
|
||||
|
||||
/**
|
||||
* 基于redis的会话管理
|
||||
*
|
||||
* @author fengshuonan
|
||||
* @date 2019-09-28-14:43
|
||||
*/
|
||||
public class DefaultSessionManager implements SessionManagerApi {
|
||||
public class DefaultSessionManager implements SessionManagerApi, ConfigUpdateCallback {
|
||||
|
||||
/**
|
||||
* 登录用户缓存
|
||||
|
@ -215,4 +219,14 @@ public class DefaultSessionManager implements SessionManagerApi {
|
|||
return loginUsers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void configUpdate(String code, String value) {
|
||||
// 如果系统配置修改了websocket url,则刷新所有在线用户的配置
|
||||
if (WEB_SOCKET_WS_URL_CONFIG_CODE.equals(code)) {
|
||||
List<LoginUser> loginUsers = this.onlineUserList();
|
||||
for (LoginUser loginUser : loginUsers) {
|
||||
loginUser.setWsUrl(WebSocketConfigExpander.getWebSocketWsUrl());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -52,4 +52,9 @@ public interface MessageConstants {
|
|||
*/
|
||||
String DEFAULT_WS_URL = "ws://localhost:8080/webSocket/{token}";
|
||||
|
||||
/**
|
||||
* 系统配置中websocket url的变量编码
|
||||
*/
|
||||
String WEB_SOCKET_WS_URL_CONFIG_CODE = "WEB_SOCKET_WS_URL";
|
||||
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil;
|
|||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.stylefeng.roses.kernel.cache.api.CacheOperatorApi;
|
||||
import cn.stylefeng.roses.kernel.config.api.constants.ConfigConstants;
|
||||
import cn.stylefeng.roses.kernel.db.api.factory.PageFactory;
|
||||
import cn.stylefeng.roses.kernel.db.api.factory.PageResultFactory;
|
||||
import cn.stylefeng.roses.kernel.db.api.pojo.entity.BaseEntity;
|
||||
|
@ -254,7 +255,10 @@ public class SysThemeServiceImpl extends ServiceImpl<SysThemeMapper, SysTheme> i
|
|||
|
||||
@Override
|
||||
public void configUpdate(String code, String value) {
|
||||
clearThemeCache();
|
||||
// 如果服务默认部署的环境地址被修改
|
||||
if (ConfigConstants.SYS_SERVER_DEPLOY_HOST.equals(code)) {
|
||||
clearThemeCache();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue