protected void validateUrl ( String field , String errorKey , String errorMessage ) { String value = controller . getPara ( field ) ; if ( StrKit . isBlank ( value ) ) { addError ( errorKey , errorMessage ) ; return ; } try { value = value . trim ( ) ; if ( value . startsWith ( "https://" ) ) { value = "http://" + value . substring ( 8 ) ; // URL doesn't understand the https protocol, hack it } new URL ( value ) ; } catch ( MalformedURLException e ) { addError ( errorKey , errorMessage ) ; } }
Validate URL .