public class HttpUtil extends Object
| Constructor and Description |
|---|
HttpUtil() |
| Modifier and Type | Method and Description |
|---|---|
static String |
buildParams(Map<String,String> params)
Generates a query string from given Map while sorting the parameters in
the canonical order as required by oAuth before signing
|
static String |
decodeURIComponent(String encodedURI)
It decodes the given string
|
static Response |
doHttpRequest(String urlStr,
String requestMethod,
Map<String,String> params,
Map<String,String> header,
InputStream inputStream,
String fileName,
String fileParamName) |
static Response |
doHttpRequest(String urlStr,
String requestMethod,
String body,
Map<String,String> header)
Makes HTTP request using java.net.HTTPURLConnection
|
static String |
encodeURIComponent(String value) |
static void |
setConnectionTimeout(int timeout)
Sets the connection time out.
|
static void |
setProxyConfig(String host,
int port)
Sets the proxy host and port.
|
static void |
write(DataOutputStream out,
String outStr) |
public static Response doHttpRequest(String urlStr, String requestMethod, String body, Map<String,String> header) throws SocialAuthException
urlStr - the URL StringrequestMethod - Method typebody - Body to pass in request.header - Header parametersSocialAuthExceptionpublic static Response doHttpRequest(String urlStr, String requestMethod, Map<String,String> params, Map<String,String> header, InputStream inputStream, String fileName, String fileParamName) throws SocialAuthException
urlStr - the URL StringrequestMethod - Method typeparams - Parameters to pass in requestheader - Header parametersinputStream - Input stream of imagefileName - Image file namefileParamName - Image Filename parameter. It requires in some provider.SocialAuthExceptionpublic static String buildParams(Map<String,String> params) throws Exception
params - Parameters Map to generate query stringExceptionpublic static String encodeURIComponent(String value) throws Exception
Exceptionpublic static String decodeURIComponent(String encodedURI)
encodedURI - public static void setProxyConfig(String host, int port)
host - proxy hostport - proxy portpublic static void setConnectionTimeout(int timeout)
timeout - httpconnection timeout valuepublic static void write(DataOutputStream out, String outStr) throws IOException
IOExceptionCopyright © 2018. All Rights Reserved.