code: static String cleanContextPath(String contextPath) {
          // Special handling so that / can be used for the root context as well
          if (contextPath.equals("/") || contextPath.trim().equals("")) {
              return "";
          } else if (!contextPath.startsWith("/")) {
              return "/" + contextPath;
          } else {
              return contextPath;
          }
      }
docs: Cleans the specified context path. Adds a forward slash if one
  is missing and make sure to interpret both the empty string and
  '/' as the root context.
  
  @param contextPath the context path to clean
  @return the context path to use