资源简介
帮助新手同学搭建了一个开发环境,项目用maven管理。集成了Spring4.0.6,SpringMvc,Mybatis3.2.7重要的是集成了目前比较流行的前端框架AdminLTE。并且对AdminLTE首页进行了框架式的处理。欢迎下载使用。
代码片段和文件信息
package com.adminlte.commons.scan;
import java.util.Date;
import java.util.Enumeration;
import javax.servlet.http.HttpServletRequest;
import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.PrincipalCollection;
import org.apache.shiro.subject.Subject;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import com.adminlte.commons.utils.StringUtils;
import com.adminlte.pojo.SysLog;
import com.adminlte.service.ISysLogService;
import com.adminlte.shiro.ShiroUser;
/**
* AOP日志
* @author wuyudong
*
*/
@Aspect
@Component
public class SysLogAspect {
private static final Logger LOGGER = LogManager.getLogger(SysLogAspect.class);
@Autowired
private ISysLogService sysLogService;
@Pointcut(“within(@org.springframework.stereotype.Controller *)“)
public void cutController() {}
@Around(“cutController()“)
public object recordSysLog(ProceedingJoinPoint point) throws Throwable {
String strMethodName = point.getSignature().getName();
String strClassName = point.getTarget().getClass().getName();
object[] params = point.getArgs();
StringBuffer bfParams = new StringBuffer();
Enumeration paraNames = null;
HttpServletRequest request = null;
if (params != null && params.length > 0) {
request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
paraNames = request.getParameterNames();
String key;
String value;
while (paraNames.hasMoreElements()) {
key = paraNames.nextElement();
value = request.getParameter(key);
bfParams.append(key).append(“=“).append(value).append(“&“);
}
if (StringUtils.isBlank(bfParams)) {
bfParams.append(request.getQueryString());
}
}
String strMessage = String
.format(“[类名]:%s[方法]:%s[参数]:%s“ strClassName strMethodName bfParams.toString());
LOGGER.info(strMessage);
if (isWriteLog(strMethodName)) {
try {
ShiroUser currentUser = (ShiroUser)SecurityUtils.getSubject().getPrincipal();
if (null != currentUser) {
SysLog sysLog = new SysLog();
sysLog.setLoginName(currentUser.getLoginName());
sysLog.setRoleName(currentUser.getName());
sysLog.setOptContent(strMess
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2017-04-19 10:54 adminlte-manage+mysql\
文件 1519 2017-04-18 17:14 adminlte-manage+mysql\.classpath
文件 1224 2017-04-18 17:14 adminlte-manage+mysql\.project
目录 0 2017-04-18 17:14 adminlte-manage+mysql\.settings\
文件 639 2017-04-18 17:05 adminlte-manage+mysql\.settings\.jsdtscope
文件 165 2017-04-18 17:14 adminlte-manage+mysql\.settings\org.eclipse.core.resources.prefs
文件 430 2017-04-18 17:14 adminlte-manage+mysql\.settings\org.eclipse.jdt.core.prefs
文件 90 2017-04-18 17:05 adminlte-manage+mysql\.settings\org.eclipse.m2e.core.prefs
文件 686 2017-04-18 17:14 adminlte-manage+mysql\.settings\org.eclipse.wst.common.component
文件 252 2017-04-18 17:14 adminlte-manage+mysql\.settings\org.eclipse.wst.common.project.facet.core.xm
文件 49 2017-04-18 17:05 adminlte-manage+mysql\.settings\org.eclipse.wst.jsdt.ui.superType.container
文件 6 2017-04-18 17:05 adminlte-manage+mysql\.settings\org.eclipse.wst.jsdt.ui.superType.name
文件 50 2017-04-18 17:05 adminlte-manage+mysql\.settings\org.eclipse.wst.validation.prefs
文件 8875 2017-04-19 11:09 adminlte-manage+mysql\pom.xm
目录 0 2017-04-19 10:54 adminlte-manage+mysql\sql\
文件 14714 2017-04-19 10:55 adminlte-manage+mysql\sql\adminlte.sql
目录 0 2017-04-18 17:05 adminlte-manage+mysql\src\
目录 0 2017-04-18 17:05 adminlte-manage+mysql\src\main\
目录 0 2017-04-18 17:05 adminlte-manage+mysql\src\main\java\
目录 0 2017-04-18 17:11 adminlte-manage+mysql\src\main\java\com\
目录 0 2017-04-18 17:11 adminlte-manage+mysql\src\main\java\com\adminlte\
目录 0 2017-04-18 17:09 adminlte-manage+mysql\src\main\java\com\adminlte\commons\
目录 0 2017-04-18 17:05 adminlte-manage+mysql\src\main\java\com\adminlte\commons\scan\
文件 3795 2017-04-18 17:11 adminlte-manage+mysql\src\main\java\com\adminlte\commons\scan\SysLogAspect.java
目录 0 2017-04-18 17:05 adminlte-manage+mysql\src\main\java\com\adminlte\commons\utils\
文件 4012 2017-04-19 11:10 adminlte-manage+mysql\src\main\java\com\adminlte\commons\utils\CaptchaUtils.java
文件 648 2017-04-18 17:09 adminlte-manage+mysql\src\main\java\com\adminlte\commons\utils\StringEscapeEditor.java
文件 2900 2017-04-18 17:09 adminlte-manage+mysql\src\main\java\com\adminlte\commons\utils\StringUtils.java
目录 0 2017-04-19 09:40 adminlte-manage+mysql\src\main\java\com\adminlte\controller\
文件 1346 2017-04-18 17:11 adminlte-manage+mysql\src\main\java\com\adminlte\controller\ba
文件 1203 2017-04-19 11:11 adminlte-manage+mysql\src\main\java\com\adminlte\controller\CodeController.java
............此处省略1566个文件信息
- 上一篇:上海交大SJTU《人工智能》 期末复习资料
- 下一篇:温湿度显示和数据库存储
相关资源
- AdminLTE 2.3.6
- AdminLTE-3.0.5最新版.zip
- springMVC+hibernate+spring+shiro整合
- AdminLTE-2.4.3
- AdminLTE-2.4.3最新版
- springboot+mybatis+layui+shiro 权限注解-后台
- springboot+mybatis+shiro+rabbitmq+redis项目实
- AdminLTE后台管理模板最新版
- ssm+shiro+redis 登录控制及重试次数超过
- meven+ssm+shiro实现前后端分离登录小案
- springboot+mybatis+shiro整合demo
- SSM+Shiro+BootStrap框架整合源码
- maven+ssm+shiro
- springboot+redis+shiro单点登录,统一异常
- SpringMVC+Shiro+MongoDB+BootStrap基础框架
- springboot+shiro代码demo
- IDEA+SpringBoot+Mybatis+shiro:整个shiro的实
- springboot+bootstrap+shiro权限管理
- spring boot+mybatis+shiro+spring security权限管
- springMVC+mybatis+shiro+redis 项目整合demo
- spring+shiro 增删改查权限控制
- spring+springMVC+shiro 完美
评论
共有 条评论