Package ca.uqac.lif.cep.http
Class HttpGateway
- java.lang.Object
-
- ca.uqac.lif.cep.http.HttpGateway
-
public abstract class HttpGateway extends java.lang.ObjectUtility methods for handling HTTP requests.- Author:
- Sylvain Hall�
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.Strings_userAgent
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.StringsendGet(java.lang.String url)Sends a GET request to a specified URLstatic java.lang.StringsendPost(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.IOExceptionSends 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.IOExceptionSends 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
-
-