return uriEscaper(true);
private String escape(String src) { return CharEscapers.xmlEscaper().escape(src); }
return uriEscaper(true);
private String escape(String src) { return CharEscapers.xmlEscaper().escape(src); }
return uriEscaper(true);
private String escape(String src) { return CharEscapers.xmlEscaper().escape(src); }
/** * Formats the input string for inclusion in a url. Account for the * differences in how OAuth encodes certain characters (such as the * space character). * * @param stringToEncode the string to encode * @return the url-encoded string */ public static String encode(String stringToEncode) { return CharEscapers.uriEscaper().escape(stringToEncode).replace("+", "%20") .replace("*", "%2A").replace("%7E", "~"); } }
/** * Formats the input string for inclusion in a url. Account for the * differences in how OAuth encodes certain characters (such as the * space character). * * @param stringToEncode the string to encode * @return the url-encoded string */ public static String encode(String stringToEncode) { return CharEscapers.uriEscaper().escape(stringToEncode).replace("+", "%20") .replace("*", "%2A").replace("%7E", "~"); } }
/** * Formats the input string for inclusion in a url. Account for the * differences in how OAuth encodes certain characters (such as the * space character). * * @param stringToEncode the string to encode * @return the url-encoded string */ public static String encode(String stringToEncode) { return CharEscapers.uriEscaper().escape(stringToEncode).replace("+", "%20") .replace("*", "%2A").replace("%7E", "~"); } }
/** * Percent-encodes a Unicode string into a US-ASCII string. The {@link * #DEFAULT_ENCODING}, UTF-8, is used to determine how non-US-ASCII and * reserved characters should be represented as consecutive sequences of the * form "%<i>XX</i>". * * <p>This replaces ' ' with '+'. So this method should not be * used for non application/x-www-form-urlencoded strings such as * host and path. * * @param string a Unicode string * @return a percent-encoded US-ASCII string * @throws NullPointerException if {@code string} is null */ public static String encode(String string) { return CharEscapers.uriEscaper().escape(string); }
/** * Percent-encodes a Unicode string into a US-ASCII string. The {@link * #DEFAULT_ENCODING}, UTF-8, is used to determine how non-US-ASCII and * reserved characters should be represented as consecutive sequences of the * form "%<i>XX</i>". * * <p>This replaces ' ' with '+'. So this method should not be * used for non application/x-www-form-urlencoded strings such as * host and path. * * @param string a Unicode string * @return a percent-encoded US-ASCII string * @throws NullPointerException if {@code string} is null */ public static String encode(String string) { return CharEscapers.uriEscaper().escape(string); }
/** * Percent-encodes a Unicode string into a US-ASCII string. The {@link * #DEFAULT_ENCODING}, UTF-8, is used to determine how non-US-ASCII and * reserved characters should be represented as consecutive sequences of the * form "%<i>XX</i>". * * <p>This replaces ' ' with '+'. So this method should not be * used for non application/x-www-form-urlencoded strings such as * host and path. * * @param string a Unicode string * @return a percent-encoded US-ASCII string * @throws NullPointerException if {@code string} is null */ public static String encode(String string) { return CharEscapers.uriEscaper().escape(string); }
/** * Adds the query parameter with the given name and value to the URL. */ private static void addParameter(StringBuffer url, String name, String value) { name = CharEscapers.uriEscaper().escape(name); value = CharEscapers.uriEscaper().escape(value); // Make sure the url currently ends with the correct delimiter if (url.indexOf("?") == -1) { url.append('?'); } else { switch (url.charAt(url.length() - 1)) { case '?': case '&': break; default: url.append('&'); } } // Append the name/value pair url.append(name).append('=').append(value); }
/** * Adds the query parameter with the given name and value to the URL. */ private static void addParameter(StringBuffer url, String name, String value) { name = CharEscapers.uriEscaper().escape(name); value = CharEscapers.uriEscaper().escape(value); // Make sure the url currently ends with the correct delimiter if (url.indexOf("?") == -1) { url.append('?'); } else { switch (url.charAt(url.length() - 1)) { case '?': case '&': break; default: url.append('&'); } } // Append the name/value pair url.append(name).append('=').append(value); }
/** * Adds the query parameter with the given name and value to the URL. */ private static void addParameter(StringBuffer url, String name, String value) { name = CharEscapers.uriEscaper().escape(name); value = CharEscapers.uriEscaper().escape(value); // Make sure the url currently ends with the correct delimiter if (url.indexOf("?") == -1) { url.append('?'); } else { switch (url.charAt(url.length() - 1)) { case '?': case '&': break; default: url.append('&'); } } // Append the name/value pair url.append(name).append('=').append(value); }
CharEscapers.uriEscaper().escape(parameter.getKey())).append("="); content.append(CharEscapers.uriEscaper().escape(parameter.getValue())); first = false;
CharEscapers.uriEscaper().escape(parameter.getKey())).append("="); content.append(CharEscapers.uriEscaper().escape(parameter.getValue())); first = false;
CharEscapers.uriEscaper().escape(parameter.getKey())).append("="); content.append(CharEscapers.uriEscaper().escape(parameter.getValue())); first = false;
pathBuf.append("/"); pathBuf.append( CharEscapers.uriEscaper().escape(categoryFilter.toString())); if (queryString != null) { appendQueryParameter(queryBuf, GDataProtocol.Query.FULL_TEXT, CharEscapers.uriEscaper().escape(queryString)); CharEscapers.uriEscaper().escape(author)); CharEscapers.uriEscaper().escape(updatedMin.toString())); CharEscapers.uriEscaper().escape(updatedMax.toString())); CharEscapers.uriEscaper().escape(publishedMin.toString())); CharEscapers.uriEscaper().escape(publishedMax.toString())); CharEscapers.uriEscaper().escape(fields)); CharEscapers.uriEscaper().escape(customParameter.name), CharEscapers.uriEscaper().escape(customParameter.value));
pathBuf.append("/"); pathBuf.append( CharEscapers.uriEscaper().escape(categoryFilter.toString())); if (queryString != null) { appendQueryParameter(queryBuf, GDataProtocol.Query.FULL_TEXT, CharEscapers.uriEscaper().escape(queryString)); CharEscapers.uriEscaper().escape(author)); CharEscapers.uriEscaper().escape(updatedMin.toString())); CharEscapers.uriEscaper().escape(updatedMax.toString())); CharEscapers.uriEscaper().escape(publishedMin.toString())); CharEscapers.uriEscaper().escape(publishedMax.toString())); CharEscapers.uriEscaper().escape(fields)); CharEscapers.uriEscaper().escape(customParameter.name), CharEscapers.uriEscaper().escape(customParameter.value));