Java URL Value Check isValidURLWithoutProtocol(String value)

Here you can find the source of isValidURLWithoutProtocol(String value)

Description

Validate the URL without protocol

License

Apache License

Parameter

Parameter Description
value The URL to validate

Return

True if the value is a valid URL

Declaration

public static boolean isValidURLWithoutProtocol(String value) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.net.MalformedURLException;
import java.net.URL;

public class Main {
    /**/*  w ww  . j  ava  2 s . c om*/
     * Validate the URL without protocol
     * 
     * @param value The URL to validate
     * @return True if the value is a valid URL
     */
    public static boolean isValidURLWithoutProtocol(String value) {
        return isValidURL("http://" + value);
    }

    /**
     * Validate the URL
     * 
     * @param value The URL to validate
     * @return True if the value is a valid URL
     */
    public static boolean isValidURL(String value) {
        try {
            new URL(value);
            return true;
        } catch (MalformedURLException ex) {
            return false;
        }
    }
}

Related

  1. isValidURL(String urlStr)
  2. isValidURL(String urlString)
  3. isValidUrl(URI uri)
  4. isValidURL(URL url)
  5. isValidUrlDataType(URL value)
  6. isVersionCompatible(URL url)
  7. isWellFormedURL(String url_str)