public static boolean isUsableURI(URI uri) { try { java.net.URL u = new URL(uri.toString()); } catch (MalformedURLException e) { return false; } return !(uri.getPath() == null || uri.getPath().length() == 0); }
public static String URLFromURI(URI uri) { String ret = ""; if (uri == null) { log.error(""); } ret += uri.getScheme() + "://" + uri.getHost() + uri.getPath(); if (uri.getQuery() != null && uri.getQuery().length() > 0) ret += "?" + uri.getQuery(); return ret; }