List of usage examples for org.apache.commons.httpclient URI allowed_abs_path
BitSet allowed_abs_path
To view the source code for org.apache.commons.httpclient URI allowed_abs_path.
Click Source Link
From source file:be.jcdo.mp3searchengines.tools.URIUtils.java
/** * Escape and encode a string regarded as the path and query components of * an URI with a given charset./*ww w.j a v a2 s . co m*/ * * @param unescaped an unescaped string * @param charset the charset * @return the escaped string * * @throws URIException if the charset is not supported * * @see #encode */ public static String encodePathQuery(String unescaped, String charset) throws URIException { int at = unescaped.indexOf('?'); if (at < 0) { return encode(unescaped, URI.allowed_abs_path, charset); } // else return encode(unescaped.substring(0, at), URI.allowed_abs_path, charset) + '?' + encode(unescaped.substring(at + 1), URI.allowed_query, charset); }
From source file:be.jcdo.mp3searchengines.tools.URIUtils.java
/** * Escape and encode a string regarded as the path component of an URI with * a given charset./*from ww w . j a v a 2s. c o m*/ * * @param unescaped an unescaped string * @param charset the charset * @return the escaped string * * @throws URIException if the charset is not supported * * @see #encode */ public static String encodePath(String unescaped, String charset) throws URIException { return encode(unescaped, URI.allowed_abs_path, charset); }
From source file:org.apache.airavata.gfac.bes.utils.URIUtils.java
public static String encodePath(String uri) throws URIException { int doubleSlashIndex = uri.indexOf("//"); boolean hasAuthority = doubleSlashIndex >= 0; int start = -1; if (hasAuthority) { start = uri.indexOf("/", doubleSlashIndex + 2); } else {/*w ww . ja v a 2 s. co m*/ start = uri.indexOf(":"); } if (start == -1) return uri; int end = uri.indexOf("?", start + 1); if (end == -1) end = uri.indexOf("#", start + 1); if (end == -1) end = uri.length(); String before = uri.substring(0, start + 1); String path = uri.substring(start + 1, end); String after = uri.substring(end); path = URIUtil.encode(path, URI.allowed_abs_path); return before + path + after; }