Package ca.uqac.lif.cep.http
Class HttpGateway
- java.lang.Object
-
- ca.uqac.lif.cep.http.HttpGateway
-
public abstract class HttpGateway extends java.lang.Object
Utility methods for handling HTTP requests.- Author:
- Sylvain Hall�
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
s_userAgent
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.String
sendGet(java.lang.String url)
Sends a GET request to a specified URLstatic java.lang.String
sendPost(java.lang.String url, java.lang.String payload)
Sends a POST request to a specified URL
-
-
-
Field Detail
-
s_userAgent
public static final transient java.lang.String s_userAgent
- See Also:
- Constant Field Values
-
-
Method Detail
-
sendGet
public static java.lang.String sendGet(java.lang.String url) throws java.io.IOException
Sends a GET request to a specified URL- Parameters:
url
- The URL- Returns:
- The string of the HTTP response
- Throws:
java.io.IOException
- If something goes wrong with the request
-
sendPost
public static java.lang.String sendPost(java.lang.String url, java.lang.String payload) throws java.io.IOException
Sends a POST request to a specified URL- Parameters:
url
- The URLpayload
- The request's payload- Returns:
- The string of the HTTP response
- Throws:
java.io.IOException
- If something goes wrong with the request
-
-