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.
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.
Name | Description |
name | String header name |
value | String header value |
Type | Description |
IOException |
execute()
public abstract LowLevelHttpResponse execute()
Executes the request and returns a low-level HTTP response object.
Type | Description |
LowLevelHttpResponse |
Type | Description |
IOException |
getContentEncoding()
public final String getContentEncoding()
Returns the content encoding (for example "gzip"
) or null
for none.
Type | Description |
String |
getContentLength()
public final long getContentLength()
Returns the content length or less than zero if not known.
Type | Description |
long |
getContentType()
public final String getContentType()
Returns the content type or null
for none.
Type | Description |
String |
getStreamingContent()
public final StreamingContent getStreamingContent()
Returns the streaming content or null
for no content.
Type | Description |
StreamingContent |
setContentEncoding(String contentEncoding)
public final void setContentEncoding(String contentEncoding)
Sets the content encoding (for example "gzip"
) or null
for none.
Name | Description |
contentEncoding | String |
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
.
Name | Description |
contentLength | long |
Type | Description |
IOException | I/O exception |
setContentType(String contentType)
public final void setContentType(String contentType)
Sets the content type or null
for none.
Name | Description |
contentType | String |
Type | Description |
IOException | I/O exception |
setStreamingContent(StreamingContent streamingContent)
public final void setStreamingContent(StreamingContent streamingContent)
Sets the streaming content or null
for no content.
Name | Description |
streamingContent | StreamingContent |
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.
Name | Description |
connectTimeout | int timeout in milliseconds to establish a connection or |
readTimeout | int Timeout in milliseconds to read data from an established connection or
|
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.
Name | Description |
writeTimeout | int timeout in milliseconds to establish a connection or |
Type | Description |
IOException | I/O exception |