public final class RequestUtils
extends java.lang.Object
RequestBuilder.| Modifier and Type | Field and Description | 
|---|---|
| static java.lang.String | DEFAULT_ENDPOINTDefault end point for relative request. | 
| Modifier and Type | Method and Description | 
|---|---|
| static java.lang.String | encode(java.lang.String content)Encode a string into a valid URL string. | 
| static okhttp3.RequestBody | fileBody(java.io.File file,
        java.lang.String contentType)Returns a request body that encapsulates the specified file qualified with the specified content type. | 
| static java.lang.String | getUserAgent()Gets the user agent. | 
| static okhttp3.RequestBody | inputStreamBody(java.io.InputStream stream,
               java.lang.String contentType)Returns a request body the encapsulates the specified input stream qualified with the specified content type. | 
| static boolean | isRelative(okhttp3.Request request)Checks if is relative. | 
| static java.lang.String | join(java.lang.Iterable<?> iterable,
    java.lang.String separator)Creates a String of all elements of an iterable, separated by a separator. | 
| static <T> java.lang.String | join(T[] array,
    java.lang.String separator)Creates a String of all elements of an array, separated by a separator. | 
| static java.util.Map<java.lang.String,java.lang.Object> | omit(java.util.Map<java.lang.String,java.lang.Object> params,
    java.lang.String... toOmit)Return a copy of a  Mapexcluding the given key, or array of keys. | 
| static java.util.Map<java.lang.String,java.lang.Object> | pick(java.util.Map<java.lang.String,java.lang.Object> params,
    java.lang.String... toPick)Return a copy of a  Mapwith only the specified given key, or array of keys. | 
| static java.lang.String | replaceEndPoint(java.lang.String url,
               java.lang.String endPoint)Replace the url end point (schema + host + port) with the given end point. | 
public static final java.lang.String DEFAULT_ENDPOINT
WatsonService with the real service end
 point.public static java.lang.String encode(java.lang.String content)
content - the contentpublic static boolean isRelative(okhttp3.Request request)
request - the okhttp3 requestpublic static java.util.Map<java.lang.String,java.lang.Object> omit(java.util.Map<java.lang.String,java.lang.Object> params,
                                                                    java.lang.String... toOmit)
Map excluding the given key, or array of keys.params - the parameterstoOmit - the keys to omitpublic static java.util.Map<java.lang.String,java.lang.Object> pick(java.util.Map<java.lang.String,java.lang.Object> params,
                                                                    java.lang.String... toPick)
Map with only the specified given key, or array of keys. If toPick is empty all
 keys will remain in the Map.params - the parameterstoPick - the keys to pickpublic static java.lang.String replaceEndPoint(java.lang.String url,
                                               java.lang.String endPoint)
url - the url to updateendPoint - the end pointpublic static <T> java.lang.String join(T[] array,
                                        java.lang.String separator)
T - the generic typearray - the arrayseparator - the separatorpublic static java.lang.String join(java.lang.Iterable<?> iterable,
                                    java.lang.String separator)
iterable - the iterableseparator - the separatorpublic static java.lang.String getUserAgent()
public static okhttp3.RequestBody fileBody(java.io.File file,
                                           java.lang.String contentType)
file - the file content to POST/PUTcontentType - the HTTP contentType to use.RequestBodypublic static okhttp3.RequestBody inputStreamBody(java.io.InputStream stream,
                                                  java.lang.String contentType)
stream - the input stream content to POST/PUTcontentType - the HTTP contentType to use.RequestBody