Package de.sfuhrm.radiorecorder.http
Interface HttpConnectionBuilder
-
public interface HttpConnectionBuilderConfigures an HttpConnection. The connection can be created after construction.- Author:
- Stephan Fuhrmann
- See Also:
for building a HttpConnection
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description HttpConnectionbuild()Constructs a connection from this builder.voidsetConnectTimeout(int timeout)Configures the timeout for connecting to the server.voidsetProxy(URL proxy)Sets the HTTP/HTTPS proxy to use.voidsetReadTimeout(int timeout)Configures the timeout for reading from the server.voidsetRequestProperty(String key, String value)Adds a HTTP request header field to the request.
-
-
-
Method Detail
-
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
void setRequestProperty(String key, String value)
Adds a HTTP request header field to the request.- Parameters:
key- the header field name, for example "User-Agent".value- the header field value.
-
setProxy
void setProxy(URL proxy)
Sets the HTTP/HTTPS proxy to use.- Parameters:
proxy- the URL of the proxy to use.
-
build
HttpConnection build() throws IOException
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.
-
-