UrlSource

constructor(source: String, connectTimeout: Duration = DEFAULT_CONNECT_TIMEOUT, readTimeout: Duration = DEFAULT_READ_TIMEOUT, fetchTimeout: Duration = Duration.INFINITE, maxBytes: Long = Long.MAX_VALUE, followRedirects: Boolean = false)

Parameters

source

the URL to read content from

connectTimeout

the maximum time to wait for a connection (default 10 seconds)

readTimeout

the maximum time to wait for data once connected (default 30 seconds)

fetchTimeout

the maximum time for the whole fetch, from connecting to reading the last byte (default none); when it passes, content throws a java.net.SocketTimeoutException

maxBytes

the largest body accepted, in bytes (default no limit); a larger one, or a Content-Length that announces one, makes content throw an java.io.IOException

followRedirects

whether to follow HTTP redirects (default false); a 3xx response that is not followed, every one when false, makes content throw a java.net.ProtocolException


constructor(source: String)

Creates a UrlSource with the default timeouts and limits.


constructor(source: String, connectTimeout: Duration, readTimeout: Duration)

Creates a UrlSource with timeouts given as java.time.Duration, for Java callers: the constructor taking Kotlin durations cannot be called from Java.

Parameters

source

the URL to read content from

connectTimeout

the maximum time to wait for a connection

readTimeout

the maximum time to wait for data once connected


constructor(source: String, connectTimeout: Duration, readTimeout: Duration, fetchTimeout: Duration, maxBytes: Long, followRedirects: Boolean)

Creates a UrlSource with timeouts given as java.time.Duration and every limit, for Java callers: the constructor taking Kotlin durations cannot be called from Java.

Parameters

source

the URL to read content from

connectTimeout

the maximum time to wait for a connection

readTimeout

the maximum time to wait for data once connected

fetchTimeout

the maximum time for the whole fetch; java.time.Duration.ZERO means none

maxBytes

the largest body accepted, in bytes; Long.MAX_VALUE means no limit

followRedirects

whether to follow HTTP redirects