public interface IConnection
| Modifier and Type | Method and Description |
|---|---|
void |
addRequestHeader(java.lang.String headerName,
java.lang.String headerValue)
Adds a header to the connection (Must be done before reading/writing)
|
void |
close()
Closes this connection, and all streams become inaccessible
|
int |
getContentLength()
Returns the Content-Length
|
java.util.Map<java.lang.String,java.lang.String> |
getHeaders()
Gets the response headers for this connection
|
java.io.InputStream |
getInputStream()
Gets the stream to read to the response
|
java.io.OutputStream |
getOutputStream()
Gets the stream to write to the request
|
java.lang.String |
getRequestMethod()
Gets the HTTP request method
|
int |
getResponseCode()
Gets the response code for the request
|
java.util.Map<java.lang.String,java.util.List<java.lang.String>> |
getResponseHeaders() |
java.lang.String |
getResponseMessage()
Get the response message
|
void |
setConnectTimeout(int connectTimeoutMilliseconds)
Set the connect timeout on the connection
|
void |
setContentLength(int length)
Set the Content-Length header
|
void |
setFollowRedirects(boolean followRedirects)
Follow 3XX series redirects
|
void |
setReadTimeout(int readTimeoutMilliseconds)
Set the read timeout on the connection
|
void setFollowRedirects(boolean followRedirects)
followRedirects - true to follow redirects, false otherwisevoid addRequestHeader(java.lang.String headerName,
java.lang.String headerValue)
headerName - the header nameheaderValue - the header valuejava.io.OutputStream getOutputStream()
throws java.io.IOException
java.io.IOException - if something goes wrong while getting the streamjava.io.InputStream getInputStream()
throws java.io.IOException
java.io.IOException - if something goes wrong while getting the streamint getResponseCode()
throws java.io.IOException
java.io.IOException - if something goes wrong while getting the response codejava.lang.String getResponseMessage()
throws java.io.IOException
java.io.IOException - if something goes wrong while getting the response messagevoid close()
java.util.Map<java.lang.String,java.lang.String> getHeaders()
java.util.Map<java.lang.String,java.util.List<java.lang.String>> getResponseHeaders()
java.lang.String getRequestMethod()
int getContentLength()
void setContentLength(int length)
length - the length of contentvoid setConnectTimeout(int connectTimeoutMilliseconds)
connectTimeoutMilliseconds - the connection timeout in millisecondsvoid setReadTimeout(int readTimeoutMilliseconds)
readTimeoutMilliseconds - the read timeout in milliseconds