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