code: private static boolean resourceExist(ExternalContext externalContext, String path)
      {
          if ("/".equals(path))
          {
              // The root context exists always
              return true;
          }
          Object ctx = externalContext.getContext();
          if (ctx instanceof ServletContext)
          {
              ServletContext servletContext = (ServletContext) ctx;
              InputStream stream = servletContext.getResourceAsStream(path);
              if (stream != null)
              {
                  try
                  {
                      stream.close();
                  }
                  catch (IOException e)
                  {
                      // Ignore here, since we donnot wanted to read from this
                      // resource anyway
                  }
                  return true;
              }
          }
          return false;
      }
docs: doesnt exist. Otherwise, the URL will fail on the first access.