📄 logout.java
字号:
package com.laoer.bbscs.web.action;
import javax.servlet.http.*;
import org.apache.struts.action.*;
import com.laoer.bbscs.bean.*;
import com.laoer.bbscs.comm.*;
import com.laoer.bbscs.exception.*;
import com.laoer.bbscs.service.*;
import com.laoer.bbscs.service.config.*;
import com.laoer.bbscs.web.servlet.*;
public class Logout
extends BaseAction {
private SysConfig sysConfig;
private UserOnlineService userOnlineService;
public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request,
HttpServletResponse response) {
UserSession us = this.getUserSession(request);
if (us != null) {
UserOnline uo = this.getUserOnlineService().findUserOnlineByUserID(us.getId());
if (uo != null) {
try {
this.getUserOnlineService().removeUserOnline(uo);
}
catch (BbscsException ex) {
}
}
//this.getUserPermissionCache().remove(us.getId());
}
HttpSession session = request.getSession();
session.removeAttribute(Constant.USER_SESSION_KEY);
UserCookie uc = this.getUserCookie(request, response, this.getSysConfig());
uc.removeAllCookies();
if (this.getSysConfig().getLogoutUrl().startsWith("/")) {
return new ActionForward(BBSCSUtil.getActionMappingURL(this.getSysConfig().getLogoutUrl()), true);
}
else {
return new ActionForward(this.getSysConfig().getLogoutUrl(), true);
}
}
public SysConfig getSysConfig() {
return sysConfig;
}
public UserOnlineService getUserOnlineService() {
return userOnlineService;
}
public void setSysConfig(SysConfig sysConfig) {
this.sysConfig = sysConfig;
}
public void setUserOnlineService(UserOnlineService userOnlineService) {
this.userOnlineService = userOnlineService;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -