/** * Encode a String using the {@link #PATHSAFE} set of characters. * <p> * Used by URIBuilder to encode path segments. * * @param content the string to encode, does not convert space to '+' * @param charset the charset to use * @return the encoded string */ static String encPath(final String content, final Charset charset) { return urlEncode(content, charset, PATHSAFE, false); }
/** * Encode a String using the {@link #URIC} set of characters. * <p> * Used by URIBuilder to encode the query and fragment segments. * * @param content the string to encode, does not convert space to '+' * @param charset the charset to use * @return the encoded string */ static String encUric(final String content, final Charset charset) { return urlEncode(content, charset, URIC, false); }
/** * Encode a String using the {@link #USERINFO} set of characters. * <p> * Used by URIBuilder to encode the userinfo segment. * * @param content the string to encode, does not convert space to '+' * @param charset the charset to use * @return the encoded string */ static String encUserInfo(final String content, final Charset charset) { return urlEncode(content, charset, USERINFO, false); }
/** * Encode/escape www-url-form-encoded content. * <p> * Uses the {@link #URLENCODER} set of characters, rather than * the {@link #UNRSERVED} set; this is for compatibilty with previous * releases, URLEncoder.encode() and most browsers. * * @param content the content to encode, will convert space to '+' * @param charset the charset to use * @return encoded string */ private static String encodeFormFields (final String content, final Charset charset) { if (content == null) { return null; } return urlEncode(content, charset != null ? charset : Consts.UTF_8, URLENCODER, true); }
/** * Encode/escape www-url-form-encoded content. * <p> * Uses the {@link #URLENCODER} set of characters, rather than * the {@link #UNRSERVED} set; this is for compatibilty with previous * releases, URLEncoder.encode() and most browsers. * * @param content the content to encode, will convert space to '+' * @param charset the charset to use * @return encoded string */ private static String encodeFormFields(final String content, final String charset) { if (content == null) { return null; } return urlEncode(content, charset != null ? Charset.forName(charset) : Consts.UTF_8, URLENCODER, true); }