@Override
 public void doGet(HttpServletRequest req, HttpServletResponse resp)
     throws ServletException, IOException {
   Pair<String, RequestType> pair = parseRequestType(req);
   RequestType requestType = pair.getSecond();
   String path = pair.getFirst();
   switch (requestType) {
     case HANDLE_TASK:
       TaskHandler.doPost(req);
       break;
     case GET_JSON:
       JsonTreeHandler.doGet(req, resp);
       break;
     case GET_JSON_LIST:
       JsonListHandler.doGet(req, resp);
       break;
     case GET_JSON_CLASS_FILTER:
       JsonClassFilterHandler.doGet(req, resp);
       break;
     case ABORT_JOB:
       AbortJobHandler.doGet(req, resp);
       break;
     case DELETE_JOB:
       DeleteJobHandler.doGet(req, resp);
       break;
     case HANDLE_STATIC:
       StaticContentHandler.doGet(resp, path);
       break;
     default:
       throw new ServletException("Unknown request type: " + requestType);
   }
 }
 private Pair<String, RequestType> parseRequestType(HttpServletRequest req) {
   String path = req.getPathInfo();
   path = path == null ? "" : path.substring(1); // Take off the leading '/'
   RequestType requestType = RequestType.HANDLE_STATIC;
   for (RequestType rt : RequestType.values()) {
     if (rt.matches(path)) {
       requestType = rt;
       break;
     }
   }
   return Pair.of(path, requestType);
 }