import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.jsczxy2.exception.DwrException;
import com.jsczxy2.web.dwr.BaseDwr;
/**
* @author jsczxy2
* DWR权限AOP
*/
@Aspect
@Component
public class DwrAspect {
Log log = LogFactory.getLog(getClass());
@Autowired
private BaseDwr baseDwr;
@Before("execution(* com.jsczxy2.web.dwr..*.*(..)) && !execution(* com.jsczxy2.web.dwr.BaseDwr.*(..))")
public void checkLogin(JoinPoint jp) throws Throwable{
if(baseDwr.getRequest().getSession().getAttribute("user")==null){
throw new DwrException("登录后才能进行操作");
}
}
}