Class LowLevelHttpRequest (1.44.2)

public abstract class LowLevelHttpRequest

Low-level HTTP request.

This allows providing a different implementation of the HTTP request that is more compatible with the Java environment used.

Implementation has no fields and therefore thread-safe, but sub-classes are not necessarily thread-safe.

Inheritance

java.lang.Object > LowLevelHttpRequest

Constructors

LowLevelHttpRequest()

public LowLevelHttpRequest()

Methods

addHeader(String name, String value)

public abstract void addHeader(String name, String value)

Adds a header to the HTTP request.

Note that multiple headers of the same name need to be supported, in which case #addHeader will be called for each instance of the header.

Parameters
Name Description
name String

header name

value String

header value

Exceptions
Type Description
IOException

execute()

public abstract LowLevelHttpResponse execute()

Executes the request and returns a low-level HTTP response object.

Returns
Type Description
LowLevelHttpResponse
Exceptions
Type Description
IOException

getContentEncoding()

public final String getContentEncoding()

Returns the content encoding (for example "gzip") or null for none.

Returns
Type Description
String

getContentLength()

public final long getContentLength()

Returns the content length or less than zero if not known.

Returns
Type Description
long

getContentType()

public final String getContentType()

Returns the content type or null for none.

Returns
Type Description
String

getStreamingContent()

public final StreamingContent getStreamingContent()

Returns the streaming content or null for no content.

Returns
Type Description
StreamingContent

setContentEncoding(String contentEncoding)

public final void setContentEncoding(String contentEncoding)

Sets the content encoding (for example "gzip") or null for none.

Parameter
Name Description
contentEncoding String
Exceptions
Type Description
IOException

I/O exception

setContentLength(long contentLength)

public final void setContentLength(long contentLength)

Sets the content length or less than zero if not known.

Default value is -1.

Parameter
Name Description
contentLength long
Exceptions
Type Description
IOException

I/O exception

setContentType(String contentType)

public final void setContentType(String contentType)

Sets the content type or null for none.

Parameter
Name Description
contentType String
Exceptions
Type Description
IOException

I/O exception

setStreamingContent(StreamingContent streamingContent)

public final void setStreamingContent(StreamingContent streamingContent)

Sets the streaming content or null for no content.

Parameter
Name Description
streamingContent StreamingContent
Exceptions
Type Description
IOException

I/O exception

setTimeout(int connectTimeout, int readTimeout)

public void setTimeout(int connectTimeout, int readTimeout)

Sets the connection and read timeouts.

Default implementation does nothing, but subclasses should normally override.

Parameters
Name Description
connectTimeout int

timeout in milliseconds to establish a connection or 0 for an infinite timeout

readTimeout int

Timeout in milliseconds to read data from an established connection or 0 for an infinite timeout

Exceptions
Type Description
IOException

I/O exception

setWriteTimeout(int writeTimeout)

public void setWriteTimeout(int writeTimeout)

Sets the write timeout for POST/PUT requests.

Default implementation does nothing, but subclasses should normally override.

Parameter
Name Description
writeTimeout int

timeout in milliseconds to establish a connection or 0 for an infinite timeout

Exceptions
Type Description
IOException

I/O exception