예제 #1
0
 protected boolean handleReviewRequest(
     HttpServletRequest req, HttpServletResponse resp, IPath path)
     throws ServletException, IOException {
   // Get the requested resources from the designer's folder
   // Remove the follow URL prefix
   // /user/heguyi/ws/workspace/.review/snapshot/20100101/project1/folder1/sample1.html
   // to
   // /.review/snapshot/20100101/project1/folder1/sample1.html
   if (isValidReviewPath(path)) {
     String designerName = path.segment(1);
     path = path.removeFirstSegments(4);
     IVResource vr = reviewManager.getDesignerUser(designerName).getResource(path);
     if (vr != null) {
       writePage(req, resp, vr, true);
       return true;
     }
   }
   return false;
 }
예제 #2
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);
  }
예제 #3
0
 @Override
 public void initialize() {
   super.initialize();
   reviewManager = ReviewManager.getReviewManager();
 }