List of usage examples for java.net URI getSchemeSpecificPart
public String getSchemeSpecificPart()
From source file:org.fcrepo.kernel.api.utils.ContentDigest.java
/** * Given a digest URI, get the corresponding MessageDigest algorithm * @param digestUri the digest uri//ww w.j a va2 s . com * @return MessageDigest algorithm */ public static String getAlgorithm(final URI digestUri) { if (digestUri == null) { return DEFAULT_ALGORITHM; } return schemeToAlgorithm .get(digestUri.getScheme() + ":" + digestUri.getSchemeSpecificPart().split(":", 2)[0]); }
From source file:com.marklogic.contentpump.SingleDocumentWriter.java
protected static String getPathFromURI(DocumentURI uri) { String uriStr = uri.getUri(); try {/*w w w. j a v a 2s. c om*/ URI child = new URI(uriStr); String childPath; if (child.isOpaque()) { childPath = child.getSchemeSpecificPart(); } else { childPath = child.getPath(); } return childPath; } catch (Exception ex) { LOG.error("Error parsing URI " + uriStr + "."); return uriStr; } }
From source file:org.fcrepo.kernel.utils.ContentDigest.java
/** * Given a digest URI, get the corresponding MessageDigest algorithm * @param digestUri/*w ww .j a v a 2 s . com*/ * @return */ public static String getAlgorithm(final URI digestUri) { if (digestUri == null) { return DEFAULT_ALGORITHM; } else { return schemeToAlgorithm .get(digestUri.getScheme() + ":" + digestUri.getSchemeSpecificPart().split(":", 2)[0]); } }
From source file:yrun.YarnRunnerUtil.java
private static Path getJarPath(URL url) throws IOException { URI uri; try {// w w w. j av a 2 s .c o m uri = url.toURI(); } catch (URISyntaxException e) { throw new IOException(e); } String schemeSpecificPart = uri.getSchemeSpecificPart(); String filePath = schemeSpecificPart.substring(0, schemeSpecificPart.indexOf('!')); return new Path(filePath); }
From source file:com.textocat.textokit.commons.util.DocumentUtils.java
public static String getFilename(String uriStr) throws URISyntaxException { URI uri = new URI(uriStr); String path;/*from w w w . ja va 2 s . c o m*/ if (uri.isOpaque()) { // TODO this is a hotfix. In future we should avoid setting opaque source URIs in DocumentMetadata path = uri.getSchemeSpecificPart(); } else { path = uri.getPath(); } return FilenameUtils.getName(path); }
From source file:com.google.mr4c.content.RelativeContentFactory.java
public static File toFile(URI uri, File parent) { if (!"rel".equals(uri.getScheme())) { throw new IllegalArgumentException("Expecting a relative file URI [" + uri + "]"); }/* w w w . j av a2 s . c o m*/ // Doing this because File won't take a URI with a relative path String path = uri.getSchemeSpecificPart(); return new File(parent, path); }
From source file:URISupport.java
public static URI stripScheme(URI uri) throws URISyntaxException { return new URI(stripPrefix(uri.getSchemeSpecificPart().trim(), "//")); }
From source file:me.footlights.core.crypto.SecretKey.java
/** Parse a hexadecimal URI. */ public static SecretKey parse(URI uri) throws GeneralSecurityException, org.apache.commons.codec.DecoderException { return newGenerator().setAlgorithm(uri.getScheme()) .setBytes(Hex.decodeHex(uri.getSchemeSpecificPart().toCharArray())).generate(); }
From source file:org.seedstack.seed.ws.internal.jms.SoapJmsUri.java
static SoapJmsUri parse(URI uri) { if (!"jms".equals(uri.getScheme())) { throw new IllegalArgumentException("Not a valid SOAP JMS URI " + uri.toString()); }/*from w ww . j av a 2 s. c o m*/ String ssp = uri.getSchemeSpecificPart(); String[] splitSsp = ssp.split(":", 2); if (splitSsp.length != 2) { throw new IllegalArgumentException("Invalid SOAP JMS URI " + splitSsp[0]); } String[] splitSecondPart = splitSsp[1].split("\\?", 2); if (splitSecondPart.length != 2) { throw new IllegalArgumentException("Invalid SOAP JMS URI " + splitSsp[1]); } return new SoapJmsUri(splitSsp[0], splitSecondPart[0], parseUrlQueryString(splitSecondPart[1]), uri.toASCIIString()); }
From source file:URISupport.java
public static CompositeData parseComposite(URI uri) throws URISyntaxException { CompositeData rc = new CompositeData(); rc.scheme = uri.getScheme();// w w w. j a v a 2 s .com String ssp = stripPrefix(uri.getSchemeSpecificPart().trim(), "//").trim(); parseComposite(uri, rc, ssp); rc.fragment = uri.getFragment(); return rc; }