List of usage examples for org.apache.commons.httpclient URI allowed_query
BitSet allowed_query
To view the source code for org.apache.commons.httpclient URI allowed_query.
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 va 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 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 query component of an URI with * a given charset.//from w ww.jav a 2 s . com * When a query string is not misunderstood the reserved special characters * ("&", "=", "+", ",", and "$") within a query component, this method * is recommended to use in encoding the whole query. * * @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 encodeQuery(String unescaped, String charset) throws URIException { return encode(unescaped, URI.allowed_query, charset); }
From source file:org.apache.airavata.gfac.bes.utils.URIUtils.java
public static String encodeQuery(String uri) throws URIException { int queryStart = uri.indexOf("?"); if (queryStart == -1) return uri; int queryEnd = uri.indexOf("#"); if (queryEnd == -1) queryEnd = uri.length();/*from www . j a v a2 s . c o m*/ String beforeQuery = uri.substring(0, queryStart + 1); String query = uri.substring(queryStart + 1, queryEnd); String afterQuery = uri.substring(queryEnd); query = URIUtil.encode(query, URI.allowed_query); return beforeQuery + query + afterQuery; }