public void doGet(HttpServletRequest request, HttpServletResponse response) {
    WebApplicationContext appContext =
        WebApplicationContextUtils.getWebApplicationContext(this.getServletContext());

    Authn authnService =
        (Authn) appContext.getBean("org_sakaiproject_tool_gradebook_facades_Authn");
    Authz authzService =
        (Authz) appContext.getBean("org_sakaiproject_tool_gradebook_facades_Authz");
    ContextManagement contextMgm =
        (ContextManagement)
            appContext.getBean("org_sakaiproject_tool_gradebook_facades_ContextManagement");

    authnService.setAuthnContext(request);
    String gradebookUid = contextMgm.getGradebookUid(request);

    try {
      if (gradebookUid != null) {
        StringBuilder path = new StringBuilder(request.getContextPath());
        if (authzService.isUserAbleToGrade(gradebookUid)) {
          if (logger.isDebugEnabled()) logger.debug("Sending user to the overview page");
          path.append("/overview.jsf");
        } else if (authzService.isUserAbleToViewOwnGrades(gradebookUid)) {
          if (logger.isDebugEnabled()) logger.debug("Sending user to the student view page");
          path.append("/studentView.jsf");
        } else {
          // The role filter has not been invoked yet, so this could happen here
          //					throw new RuntimeException("User " + authnService.getUserUid() + " attempted to
          // access gradebook " + gradebookUid + " without any role");
          path.append("/noRole.jsp");
        }
        String queryString = request.getQueryString();
        if (queryString != null) {
          path.append("?").append(queryString);
        }
        response.sendRedirect(path.toString());
      }
    } catch (IOException ioe) {
      logger.error("Could not redirect user: {}", ioe.getMessage(), ioe);
    }
  }
  /** Return a list of gradebooks accessible by the currently logged-in user. */
  public List getGradebooks() {
    String userUid = authnService.getUserUid();
    List gradebooks = frameworkManager.getAccessibleGradebooks(userUid);

    // JSF's "f:param" doesn't java.net.URLEncoder.encode the
    // parameter value for us. If it did, we would just return the gradebooks
    // list straight.
    List returnList = new ArrayList(gradebooks.size());
    for (Iterator iter = gradebooks.iterator(); iter.hasNext(); ) {
      Gradebook gradebook = (Gradebook) iter.next();
      returnList.add(new GradebookRow(gradebook));
    }

    return returnList;
  }