Package de.sfuhrm.radiorecorder.http
Interface HttpConnectionBuilder
public interface HttpConnectionBuilder
Configures an HttpConnection. The connection can be created
after construction.
- Author:
- Stephan Fuhrmann
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionbuild()Constructs a connection from this builder.voidsetConnectTimeout(int timeout) Configures the timeout for connecting to the server.voidSets the HTTP/HTTPS proxy to use.voidsetReadTimeout(int timeout) Configures the timeout for reading from the server.voidsetRequestProperty(String key, String value) Adds an HTTP request header field to the request.
-
Method Details
-
setConnectTimeout
void setConnectTimeout(int timeout) Configures the timeout for connecting to the server.- Parameters:
timeout- the timeout in milliseconds.
-
setReadTimeout
void setReadTimeout(int timeout) Configures the timeout for reading from the server.- Parameters:
timeout- the timeout in milliseconds.
-
setRequestProperty
Adds an HTTP request header field to the request.- Parameters:
key- the header field name, for example "User-Agent".value- the header field value.
-
setProxy
Sets the HTTP/HTTPS proxy to use.- Parameters:
proxy- the URL of the proxy to use.
-
build
Constructs a connection from this builder. The connection is usually being opened by this method.- Returns:
- an open HTTP connection.
- Throws:
IOException- if building the connection with the given parameters failed.
-