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); }