|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.brickred.socialauth.util.HttpUtil
public class HttpUtil
This class is used to make HTTP requests. We did try NOT writing this class and instead use Apache Commons HTTP Client. However it has been reported by users that Commons HTTP Client does not work on Google AppEngine. Hence we have handcoded this class using HTTPURLConnection and incorporated only as much functionality as is needed for OAuth clients. This class may be completed rewritten in future, or may be removed if a version of Commons HTTP Client compatible with AppEngine is released.
| Constructor Summary | |
|---|---|
HttpUtil()
|
|
| Method Summary | |
|---|---|
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)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public HttpUtil()
| Method Detail |
|---|
public static Response doHttpRequest(String urlStr,
String requestMethod,
String body,
Map<String,String> header)
throws Exception
urlStr - the URL StringrequestMethod - Method typebody - Body to pass in request.header - Header parameters
Exception
public static Response doHttpRequest(String urlStr,
String requestMethod,
Map<String,String> params,
Map<String,String> header,
InputStream inputStream,
String fileName,
String fileParamName)
throws Exception
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.
Exception
public static String buildParams(Map<String,String> params)
throws Exception
params - Parameters Map to generate query string
Exception
public 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 value
public static void write(DataOutputStream out,
String outStr)
throws IOException
IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||