public static String getUriPath ( String value ) { try { URL url = new URL ( value ) ; return url . getPath ( ) ; } catch ( MalformedURLException e ) { return value ; } }
This method extracts the path component of a URL . If the supplied value is not a valid URL format then it will simply return the supplied value .