public class HttpRequest extends Object
| Constructor and Description |
|---|
HttpRequest() |
| Modifier and Type | Method and Description |
|---|---|
static String |
AddCDATA(String phrase) |
static int |
checkUrl(String url,
String username,
String password) |
static void |
downloadFile(String fileurl,
String localFile) |
static Object |
getJSonData(String endpoint,
String requestParameters,
Type outputClass) |
static void |
inputStreamToFile(InputStream is,
String path) |
static String |
ManageCDATA(String phrase) |
static void |
postData(Reader data,
URL endpoint,
Writer output)
Reads data from the data reader and posts it to a server via POST request.
|
static String |
PostFileData(String url,
String host,
int port,
LinkedHashMap<String,String> parameters,
String username,
String password,
File filetosend) |
static Object |
postJSonData(String endpoint,
Object obj,
Type outputClass) |
static String |
PostXmlString(String url,
String host,
int port,
LinkedHashMap<String,String> parameters,
String username,
String password,
String xmltosend) |
static String |
sendGetRequest(String endpoint,
String requestParameters)
Sends an HTTP GET request to a url
|
static String |
sendPostRequest(String endpoint,
String requestParameters) |
static String |
toJSon(Object obj) |
public static String sendGetRequest(String endpoint, String requestParameters)
endpoint - - The URL of the server. (Example: " http://www.yahoo.com/search")requestParameters - - all the request parameters (Example: "param1=val1¶m2=val2"). Note: This method will add the question mark (?) to the request - DO NOT add it yourselfpublic static void postData(Reader data, URL endpoint, Writer output) throws Exception
Exceptionpublic static Object getJSonData(String endpoint, String requestParameters, Type outputClass) throws Exception
Exceptionpublic static Object postJSonData(String endpoint, Object obj, Type outputClass) throws Exception
Exceptionpublic static void downloadFile(String fileurl, String localFile) throws Exception
Exceptionpublic static void inputStreamToFile(InputStream is, String path) throws FileNotFoundException, IOException
FileNotFoundExceptionIOExceptionpublic static String PostXmlString(String url, String host, int port, LinkedHashMap<String,String> parameters, String username, String password, String xmltosend) throws Exception
ExceptionCopyright © 2020. All Rights Reserved.