mirror of
https://gitee.com/dromara/sa-token.git
synced 2025-12-22 03:19:44 +08:00
Merge branch 'dev' of https://gitee.com/dromara/sa-token into dev
This commit is contained in:
@@ -102,8 +102,8 @@ public class SaManager {
|
|||||||
SaTokenEventCenter.doRegisterComponent("SaTokenDao", saTokenDao);
|
SaTokenEventCenter.doRegisterComponent("SaTokenDao", saTokenDao);
|
||||||
}
|
}
|
||||||
private static void setSaTokenDaoMethod(SaTokenDao saTokenDao) {
|
private static void setSaTokenDaoMethod(SaTokenDao saTokenDao) {
|
||||||
if((SaManager.saTokenDao instanceof SaTokenDaoDefaultImpl)) {
|
if (SaManager.saTokenDao != null) {
|
||||||
((SaTokenDaoDefaultImpl)SaManager.saTokenDao).endRefreshThread();
|
SaManager.saTokenDao.onChange();
|
||||||
}
|
}
|
||||||
SaManager.saTokenDao = saTokenDao;
|
SaManager.saTokenDao = saTokenDao;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -201,4 +201,11 @@ public interface SaTokenDao {
|
|||||||
List<String> searchData(String prefix, String keyword, int start, int size, boolean sortType);
|
List<String> searchData(String prefix, String keyword, int start, int size, boolean sortType);
|
||||||
|
|
||||||
|
|
||||||
|
// --------------------- 实例相关 ---------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 当 SaManager.saTokenDao 变更时,调用该方法
|
||||||
|
*/
|
||||||
|
default void onChange() {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -264,8 +264,8 @@ public class SaTokenDaoDefaultImpl implements SaTokenDao {
|
|||||||
/**
|
/**
|
||||||
* 结束定时任务,不再定时清理过期数据
|
* 结束定时任务,不再定时清理过期数据
|
||||||
*/
|
*/
|
||||||
public void endRefreshThread() {
|
@Override
|
||||||
|
public void onChange() {
|
||||||
this.refreshFlag = false;
|
this.refreshFlag = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -74,9 +74,12 @@ public class SaTokenActionHandler extends ActionHandler {
|
|||||||
// Controller controller = action.getControllerClass().newInstance();
|
// Controller controller = action.getControllerClass().newInstance();
|
||||||
controller = controllerFactory.getController(action.getControllerClass());
|
controller = controllerFactory.getController(action.getControllerClass());
|
||||||
CPI._init_(controller, action, request, response, urlPara[0]);
|
CPI._init_(controller, action, request, response, urlPara[0]);
|
||||||
|
if (resolveJson && controller.isJsonRequest()) {
|
||||||
|
// 注入 JsonRequest 包装对象接管 request
|
||||||
|
controller.setHttpServletRequest(jsonRequestFactory.apply(controller.getRawData(), controller.getRequest()));
|
||||||
|
}
|
||||||
//加入SaToken上下文处理
|
//加入SaToken上下文处理
|
||||||
SaControllerContext.hold(controller);
|
SaControllerContext.hold(controller);
|
||||||
|
|
||||||
if (devMode) {
|
if (devMode) {
|
||||||
if (actionReporter.isReportAfterInvocation(request)) {
|
if (actionReporter.isReportAfterInvocation(request)) {
|
||||||
new Invocation(action, controller).invoke();
|
new Invocation(action, controller).invoke();
|
||||||
|
|||||||
Reference in New Issue
Block a user