Exemplo n.º 1
0
  @Override
  protected boolean handleLibraryRequest(
      HttpServletRequest req, HttpServletResponse resp, IPath path, IUser user)
      throws ServletException, IOException {
    // Remove the follow URL prefix
    // /user/heguyi/ws/workspace/.review/snapshot/20100101/project1/lib/dojo/dojo.js
    // to
    // project1/lib/dojo/dojo.js
    String version = null;
    String ownerId = null;
    String projectName = null;

    if (isValidReviewPath(path)) {
      ownerId = path.segment(1);
      version = path.segment(6);
      projectName = path.segment(7);
      path = path.removeFirstSegments(7);
      // So that each snapshot can be mapped to its virtual lib path correctly.
      path = ReviewManager.adjustPath(path, ownerId, version, projectName);
    }
    return super.handleLibraryRequest(req, resp, path, user);
  }