/** * Sets the response handler for this request. This method <b>must</b> be * called before calling {@link #send()}. * * @param callback the response handler to be notified when the request fails * or completes * * @throws NullPointerException if <code>callback</code> is <code>null</code> */ public void setCallback(RequestCallback callback) { StringValidator.throwIfNull("callback", callback); this.callback = callback; }
/** * Throws if <code>value</code> is <code>null</code> or empty. This method * ignores leading and trailing whitespace. * * @param name the name of the value, used in error messages * @param value the string value that needs to be validated * * @throws IllegalArgumentException if the string is empty, or all whitespace * @throws NullPointerException if the string is <code>null</code> */ public static void throwIfEmptyOrNull(String name, String value) { assert (name != null); assert (name.trim().length() != 0); throwIfNull(name, value); if (0 == value.trim().length()) { throw new IllegalArgumentException(name + " cannot be empty"); } }
/** * Returns a string where all URL escape sequences have been converted back to * their original character representations. * * @param encodedURL string containing encoded URL encoded sequences * @return string with no encoded URL encoded sequences * * @throws NullPointerException if encodedURL is <code>null</code> */ public static String decode(String encodedURL) { StringValidator.throwIfNull("encodedURL", encodedURL); return decodeImpl(encodedURL); }
/** * Sends an HTTP request based on the current builder configuration. If no * request headers have been set, the header "Content-Type" will be used with * a value of "text/plain; charset=utf-8". You must call * {@link #setRequestData(String)} and {@link #setCallback(RequestCallback)} * before calling this method. * * @return a {@link Request} object that can be used to track the request * @throws RequestException if the call fails to initiate * @throws NullPointerException if a request callback has not been set */ public Request send() throws RequestException { StringValidator.throwIfNull("callback", callback); return doSend(requestData, callback); }
/** * Returns a string where all URL component escape sequences have been * converted back to their original character representations. * * @param encodedURLComponent string containing encoded URL component * sequences * @return string with no encoded URL component encoded sequences * * @throws NullPointerException if encodedURLComponent is <code>null</code> */ public static String decodePathSegment(String encodedURLComponent) { StringValidator.throwIfNull("encodedURLComponent", encodedURLComponent); return decodePathSegmentImpl(encodedURLComponent); }
/** * Returns a string where all URL component escape sequences have been * converted back to their original character representations. * <p> * Note: this method will convert the space character escape short form, '+', * into a space. It should therefore only be used for query-string parts. * * @param encodedURLComponent string containing encoded URL component * sequences * @return string with no encoded URL component encoded sequences * * @throws NullPointerException if encodedURLComponent is <code>null</code> */ public static String decodeQueryString(String encodedURLComponent) { StringValidator.throwIfNull("encodedURLComponent", encodedURLComponent); return decodeQueryStringImpl(encodedURLComponent); }
/** * Sends an HTTP request based on the current builder configuration with the * specified data and callback. If no request headers have been set, the * header "Content-Type" will be used with a value of "text/plain; * charset=utf-8". This method does not cache <code>requestData</code> or * <code>callback</code>. * * @param requestData the data to send as part of the request * @param callback the response handler to be notified when the request fails * or completes * @return a {@link Request} object that can be used to track the request * @throws NullPointerException if <code>callback</code> <code>null</code> */ public Request sendRequest(String requestData, RequestCallback callback) throws RequestException { StringValidator.throwIfNull("callback", callback); return doSend(requestData, callback); }
StringValidator.throwIfNull("decodedURLComponent", decodedURLComponent); return encodePathSegmentImpl(decodedURLComponent);
StringValidator.throwIfNull("decodedURL", decodedURL); return encodeImpl(decodedURL);
StringValidator.throwIfNull("decodedURLComponent", decodedURLComponent); return encodeQueryStringImpl(decodedURLComponent);
/** * Returns a string where all URL component escape sequences have been * converted back to their original character representations. * * @param encodedURLComponent string containing encoded URL component * sequences * @param fromQueryString if <code>true</code>, +'s will be turned into * spaces, otherwise they'll be kept as-is. * @return string with no encoded URL component encoded sequences * * @throws NullPointerException if encodedURLComponent is <code>null</code> * * @deprecated Use {@link #decodeQueryString(String)}, * {@link #decodePathSegment(String)} */ @Deprecated public static String decodeComponent(String encodedURLComponent, boolean fromQueryString) { StringValidator.throwIfNull("encodedURLComponent", encodedURLComponent); return fromQueryString ? decodeQueryStringImpl(encodedURLComponent) : decodePathSegmentImpl(encodedURLComponent); }
public static String encodeComponent(String decodedURLComponent, boolean queryStringSpaces) { StringValidator.throwIfNull("decodedURLComponent", decodedURLComponent); return queryStringSpaces ? encodeQueryStringImpl(decodedURLComponent) : encodePathSegmentImpl(decodedURLComponent);
/** * Sets the response handler for this request. This method <b>must</b> be * called before calling {@link #send()}. * * @param callback the response handler to be notified when the request fails * or completes * * @throws NullPointerException if <code>callback</code> is <code>null</code> */ public void setCallback(RequestCallback callback) { StringValidator.throwIfNull("callback", callback); this.callback = callback; }
/** * Sets the response handler for this request. This method <b>must</b> be * called before calling {@link #send()}. * * @param callback the response handler to be notified when the request fails * or completes * * @throws NullPointerException if <code>callback</code> is <code>null</code> */ public void setCallback(RequestCallback callback) { StringValidator.throwIfNull("callback", callback); this.callback = callback; }
/** * Returns a string where all URL escape sequences have been converted back to * their original character representations. * * @param encodedURL string containing encoded URL encoded sequences * @return string with no encoded URL encoded sequences * * @throws NullPointerException if encodedURL is <code>null</code> */ public static String decode(String encodedURL) { StringValidator.throwIfNull("encodedURL", encodedURL); return decodeImpl(encodedURL); }
/** * Returns a string where all URL component escape sequences have been * converted back to their original character representations. * * @param encodedURLComponent string containing encoded URL component * sequences * @return string with no encoded URL component encoded sequences * * @throws NullPointerException if encodedURLComponent is <code>null</code> */ public static String decodePathSegment(String encodedURLComponent) { StringValidator.throwIfNull("encodedURLComponent", encodedURLComponent); return decodePathSegmentImpl(encodedURLComponent); }
/** * Returns a string where all URL escape sequences have been converted back to * their original character representations. * * @param encodedURL string containing encoded URL encoded sequences * @return string with no encoded URL encoded sequences * * @throws NullPointerException if encodedURL is <code>null</code> */ public static String decode(String encodedURL) { StringValidator.throwIfNull("encodedURL", encodedURL); return decodeImpl(encodedURL); }
/** * Returns a string where all URL component escape sequences have been * converted back to their original character representations. * * @param encodedURLComponent string containing encoded URL component * sequences * @return string with no encoded URL component encoded sequences * * @throws NullPointerException if encodedURLComponent is <code>null</code> */ public static String decodePathSegment(String encodedURLComponent) { StringValidator.throwIfNull("encodedURLComponent", encodedURLComponent); return decodePathSegmentImpl(encodedURLComponent); }
/** * Sends an HTTP request based on the current builder configuration. If no * request headers have been set, the header "Content-Type" will be used with * a value of "text/plain; charset=utf-8". You must call * {@link #setRequestData(String)} and {@link #setCallback(RequestCallback)} * before calling this method. * * @return a {@link Request} object that can be used to track the request * @throws RequestException if the call fails to initiate * @throws NullPointerException if a request callback has not been set */ public Request send() throws RequestException { StringValidator.throwIfNull("callback", callback); return doSend(requestData, callback); }
/** * Sends an HTTP request based on the current builder configuration. If no * request headers have been set, the header "Content-Type" will be used with * a value of "text/plain; charset=utf-8". You must call * {@link #setRequestData(String)} and {@link #setCallback(RequestCallback)} * before calling this method. * * @return a {@link Request} object that can be used to track the request * @throws RequestException if the call fails to initiate * @throws NullPointerException if a request callback has not been set */ public Request send() throws RequestException { StringValidator.throwIfNull("callback", callback); return doSend(requestData, callback); }