public abstract class LowLevelHttpRequest extends Object
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.
| Constructor and Description |
|---|
LowLevelHttpRequest()
|
| Modifier and Type | Method and Description |
|---|---|
abstract void |
addHeader(String
Adds a header to the HTTP request.
|
abstract LowLevelHttpResponse |
execute()
Executes the request and returns a low-level HTTP response object.
|
String |
getContentEncoding()
Returns the content encoding (for example
"gzip") or
null for none.
|
long |
getContentLength()
Returns the content length or less than zero if not known.
|
String |
getContentType()
Returns the content type or
null for none.
|
StreamingContent |
getStreamingContent()
Returns the streaming content or
null for no content.
|
void |
setContentEncoding(String
Sets the content encoding (for example
"gzip") or
null for none.
|
void |
setContentLength(long contentLength)
Sets the content length or less than zero if not known.
|
void |
setContentType(String
Sets the content type or
null for none.
|
void |
setStreamingContent(StreamingContent
Sets the streaming content or
null for no content.
|
void |
setTimeout(int connectTimeout, int readTimeout)
Sets the connection and read timeouts.
|
public abstract void addHeader(Stringname, String value) throws IOException
Note that multiple headers of the same name need to be supported, in which case addHeader(java.lang.String, java.lang.String) will be called for each instance of the header.
name - header name
value - header value
IOException
public final void setContentLength(long contentLength)
throws IOException
Default value is -1.
IOException - I/O exception
public final long getContentLength()
public final void setContentEncoding(StringcontentEncoding) throws IOException
"gzip") or
null for none.
IOException - I/O exception
public final StringgetContentEncoding()
"gzip") or
null for none.
public final void setContentType(StringcontentType) throws IOException
null for none.
IOException - I/O exception
public final StringgetContentType()
null for none.
public final void setStreamingContent(StreamingContentstreamingContent) throws IOException
null for no content.
IOException - I/O exception
public final StreamingContentgetStreamingContent()
null for no content.
public void setTimeout(int connectTimeout,
int readTimeout)
throws IOException
Default implementation does nothing, but subclasses should normally override.
connectTimeout - timeout in milliseconds to establish a connection or
0 for an infinite timeout
readTimeout - Timeout in milliseconds to read data from an established connection or
0 for an infinite timeout
IOException - I/O exception
public abstract LowLevelHttpResponseexecute() throws IOException
IOException