Online Help Center > SendSafely APIs

com.sendsafely.connection

Interface ConnectionManager

Interface for creating custom connection managers. By default a HTTPURLConnection is used to upload files. Implement this interface with your own HTTP Handling to use a different interface than the default.

open(Url)
Open a new connection to a given URL.
Return Type: void
Parameters:
NameTypeDescription
Url URL

getURL()
Get the URL we are currently connected to.
Return Type: URL
Parameters: N/A

getHost()
Return the host of the of the current connection.
Return Type: String
Parameters: N/A

addHeader(Header, Value)
Add an HTTP Header with a value to the request object.
Return Type: void
Parameters:
NameTypeDescription
Header String N/A
Value String N/A

setRequestMethod(Method)
Set the request method of the request. This should always be one of GET, POST, DELETE, PUT or OPTIONS
Return Type: void
Parameters:
NameTypeDescription
Method String N/A

send(Data)
Upload data to the server. Before this function is called, a connection will always have been opened by calling the open function.
Return Type: void
Parameters:
NameTypeDescription
Data String N/A

getOutputStream()
Return an output stream. The output stream will be used to upload larger data objects such as files.
Return Type: OutputStream
Parameters: N/A

getResponse()
Get the server response. Will be called after first calling send or getOutputStream
Return Type: InputStream
Parameters: N/A

getHeader(Header)
Get a header from the response.
Return Type: String
Parameters:
NameTypeDescription
Header String N/A

getHeaders()
Gets all headers from the response
Return Type: Map
Parameters: N/A

getResponseCode()
gets response code
Return Type: int
Parameters: N/A

getResponseMessage()
gets response message
Return Type: String
Parameters: N/A

getContentType()
returns the content type
Return Type: String
Parameters: N/A

getErrorStream()
Get the server error stream.
Return Type: InputStream
Parameters: N/A