public class ConnectionManager extends Object
| Constructor and Description |
|---|
ConnectionManager(String webpageUrl)
Create a new ConnectionManager with default settings to open a connection to the URL provided using the
HttpURLConnection APIs. |
ConnectionManager(String webpageUrl,
String requestMethod,
boolean doOutput)
Create a new ConnectionManager with the settings provided to open a connection to the URL provided using the
HttpURLConnection APIs. |
| Modifier and Type | Method and Description |
|---|---|
void |
addPostHeader(String key,
String value)
This method adds a HTTP POST variable key-pair to this
URLConnection. |
void |
addRequestBody(String text)
This method is used to add text to a request.
|
String |
connect() |
int |
getResponseStatus() |
void |
setRequestHeader(String field,
String value)
This method will set a request header on the
URLConnection. |
public ConnectionManager(String webpageUrl, String requestMethod, boolean doOutput)
HttpURLConnection APIs.webpageUrl - The URL of the webpage to connect to.requestMethod - The request method to use for the connection.doOutput - Whether output to the server should be done or not.public ConnectionManager(String webpageUrl)
HttpURLConnection APIs. webpageUrl - The URL of the webpage to connect to.public void addPostHeader(String key, String value)
URLConnection.key - The key used for this POST header.value - The value to use for this POST header.public void addRequestBody(String text)
text - The text to write.public void setRequestHeader(String field, String value)
URLConnection.field - The key used for this request header.value - The request header value to set.public String connect()
public int getResponseStatus()
Copyright © 2015. All rights reserved.