public class SFHttpsCaller
extends java.lang.Object
| Constructor and Description |
|---|
SFHttpsCaller() |
| Modifier and Type | Method and Description |
|---|---|
static void |
addAuthenticationHeader(java.net.URLConnection connection,
SFOAuth2Token token,
java.lang.String userName,
java.lang.String password,
SFCookieManager cookieManager)
We need a separate auth manager here to handle the setting of correct auth header based on the provider type and well as the user.
|
static void |
addBearerAuthorizationHeader(java.net.URLConnection connection,
SFOAuth2Token token) |
static int |
catchIfAuthException(java.io.IOException e) |
static int |
catchIfOutOfMemoryException(java.lang.Exception e,
int origcode) |
static void |
disconnect(java.net.URLConnection conn) |
static void |
getAndStoreCookies(java.net.URLConnection conn,
java.net.URL url,
SFCookieManager cookieManager) |
static java.lang.String |
getBodyForWebLogin(java.util.List<org.apache.http.NameValuePair> params)
grant_type=authorization_code&code=CvJ4LMgMDHuZGLXgJgJdDYR17Hd3b5&client_id=xyz&client_secret=abc
|
static SFFormsAuthenticationCookies |
getFormsAuthResponseCookies(java.net.URL url,
java.net.URLConnection connection,
SFCookieManager cookieManager) |
static void |
postBody(java.net.URLConnection conn,
java.lang.String body) |
static java.lang.String |
readErrorResponse(java.net.URLConnection conn) |
static java.lang.String |
readResponse(java.net.URLConnection conn) |
static int |
safeGetResponseCode(java.net.URLConnection conn)
The http functions sometimes respond with 401 error or sometimes throw and exception
|
static void |
setAcceptLanguage(java.net.URLConnection conn) |
static void |
setBasicAuth(java.net.URLConnection conn,
java.lang.String username,
java.lang.String password) |
static void |
setMethod(java.net.URLConnection conn,
java.lang.String methodName,
java.lang.String optionalBody) |
static void |
setPostMethod(java.net.URLConnection conn) |
public static void setBasicAuth(java.net.URLConnection conn,
java.lang.String username,
java.lang.String password)
public static void postBody(java.net.URLConnection conn,
java.lang.String body)
throws java.io.IOException
java.io.IOExceptionpublic static java.lang.String getBodyForWebLogin(java.util.List<org.apache.http.NameValuePair> params)
throws java.io.UnsupportedEncodingException
java.io.UnsupportedEncodingExceptionpublic static void setAcceptLanguage(java.net.URLConnection conn)
public static void setPostMethod(java.net.URLConnection conn)
throws java.net.ProtocolException
java.net.ProtocolExceptionpublic static void setMethod(java.net.URLConnection conn,
java.lang.String methodName,
java.lang.String optionalBody)
throws java.net.ProtocolException
java.net.ProtocolExceptionpublic static int catchIfAuthException(java.io.IOException e)
throws java.io.IOException
java.io.IOExceptionpublic static int catchIfOutOfMemoryException(java.lang.Exception e,
int origcode)
public static int safeGetResponseCode(java.net.URLConnection conn)
throws java.io.IOException
depending on what the server returns. So we need a generic way to get the error code.
java.io.IOExceptionpublic static void getAndStoreCookies(java.net.URLConnection conn,
java.net.URL url,
SFCookieManager cookieManager)
throws java.io.IOException
java.io.IOExceptionpublic static SFFormsAuthenticationCookies getFormsAuthResponseCookies(java.net.URL url, java.net.URLConnection connection, SFCookieManager cookieManager) throws java.io.IOException
java.io.IOExceptionpublic static java.lang.String readResponse(java.net.URLConnection conn)
throws java.io.IOException
java.io.IOExceptionpublic static java.lang.String readErrorResponse(java.net.URLConnection conn)
throws java.io.IOException
java.io.IOExceptionpublic static void disconnect(java.net.URLConnection conn)
public static void addBearerAuthorizationHeader(java.net.URLConnection connection,
SFOAuth2Token token)
public static void addAuthenticationHeader(java.net.URLConnection connection,
SFOAuth2Token token,
java.lang.String userName,
java.lang.String password,
SFCookieManager cookieManager)
throws java.io.IOException
java.io.IOException