示例#1
0
  /**
   * action方法拦截器方法,在action方法执行前执行
   *
   * @return 跳转页面result name,为null时不跳转
   * @throws Exception
   */
  @Before
  public String beforeDoAction() throws Exception {
    // 绑定一个httpSession到本地线程,供其它层调用
    Helper.setHttpSessionInThread(request.getSession());

    // 身份验证
    authedUser = (User) getSessionMap().get(Constants.AUTHED_USER);
    if (this.authedUser == null
        && !(request.getServletPath().equals("/system/initDb")
            || request.getServletPath().equals("/system/login")
            || request.getServletPath().startsWith("/website"))) {
      return authFailed();
    }
    return null;
  }
示例#2
0
 /** action方法拦截器方法,在return result之前执行 */
 @BeforeResult
 public void BeforeResult() {
   // 移除httpSession从本地线程
   Helper.removeHttpSessionInThread();
 }