code: public static boolean checkUrl(CmsObject cms, String check) {
  
          // first, create an URI from the string representation
          URI uri = null;
          try {
              uri = new CmsUriSplitter(check, true).toURI();
          } catch (URISyntaxException exc) {
              return false;
          }
          try {
              if (!uri.isAbsolute()) {
                  return cms.existsResource(cms.getRequestContext().removeSiteRoot(uri.getPath()));
              } else {
                  URL url = uri.toURL();
                  if ("http".equals(url.getProtocol())) {
                      // ensure that file is encoded properly
                      HttpURLConnection httpcon = (HttpURLConnection)url.openConnection();
                      int responseCode = httpcon.getResponseCode();
                      // accepting all status codes 2xx success and 3xx - redirect
                      return ((responseCode >= 200) && (responseCode < 400));
                  } else {
                      return true;
                  }
              }
          } catch (MalformedURLException mue) {
              return false;
          } catch (Exception ex) {
              return false;
          }
      }
docs: Checks if the given url is valid.<p>
  
  @param check the url to check
  @param cms a OpenCms context object
  
  @return false if the url could not be accessed