Package org.nutz.mvc.view

Examples of org.nutz.mvc.view.HttpStatusView


      User root = dao.findOne(User.class, new BasicDBObject("provider",
          "root"));
      session.setAttribute("me", root);
      return null;
    } else
      return new HttpStatusView(403);
  }
View Full Code Here


  @Filters() //查询无需任何权限
  @Ok("smart:/question/one")
  public Object fetch(String questionId) {
    Question question = dao.findById(Question.class, questionId);
    if (question == null)
      return new HttpStatusView(404);
    return question;
  }
View Full Code Here

    //具体的权限数据,是EnhanceUrlMapping类在启动过程中,通过入口方法来获取配置信息的
    Map<String, Role> roles = (Map<String, Role>) actionContext.getServletContext().getAttribute("sys.roles");
    if (roles == null) { //为了安全期间,不允许这种无权限表的情况,所有一概返回500
      if (log.isWarnEnabled())
        log.warn("Role config not found?!");
      return new HttpStatusView(500); //Deny all req
    }
    if (authService.isAuth(new AuthContext(me, auth, roles)))
      return null;
    return new HttpStatusView(403); //Not Ok,客户端就收到403响应了,标准的未授权
  }
View Full Code Here

TOP

Related Classes of org.nutz.mvc.view.HttpStatusView

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.