public class TLcdTransportResponse
extends java.lang.Object
Constructor and Description |
---|
TLcdTransportResponse(int aResponseCode,
java.lang.String aResponseReason,
java.nio.channels.ReadableByteChannel aContent,
java.util.List<TLcdPair<java.lang.String,java.lang.String>> aHeaders)
Constructs a response.
|
Modifier and Type | Method and Description |
---|---|
java.nio.channels.ReadableByteChannel |
getContent()
Gets the content for this response as a channel.
|
long |
getContentLength()
Gets the content length in bytes of this response's content.
|
java.lang.String |
getContentType()
Gets the content type (MIME type) of this response's content.
|
java.util.List<TLcdPair<java.lang.String,java.lang.String>> |
getHeaders()
Gets the headers for this response.
|
int |
getResponseCode()
Gets the HTTP response code (status code).
|
java.lang.String |
getResponseReason()
Gets the HTTP response reason (reason phrase), corresponding to
getResponseCode() . |
java.lang.String |
toString() |
public TLcdTransportResponse(int aResponseCode, java.lang.String aResponseReason, java.nio.channels.ReadableByteChannel aContent, java.util.List<TLcdPair<java.lang.String,java.lang.String>> aHeaders)
aResponseCode
- an HTTP response code, for example 404
aResponseReason
- an HTTP reason phrase corresponding to the response code, for instance "Not Found"
corresponding to 404
, may be null
aContent
- a channel providing access to the content, may be null
aHeaders
- a list of headers, may be empty but not null
.
Headers typically filled in by an LTS server are "Content-Type"
, "Content-Length"
and "ETag"
.
The latter can be used for a conditional GET
later on.public int getResponseCode()
public java.lang.String getResponseReason()
getResponseCode()
.
This represents a human-readable form of the response code.public java.lang.String getContentType()
null
public long getContentLength()
-1
.
Note that the content length is optional, so even if the content length is unspecified, the content may still have non-zero length.-1
if unspecifiedpublic java.nio.channels.ReadableByteChannel getContent()
null
public java.util.List<TLcdPair<java.lang.String,java.lang.String>> getHeaders()
"Content-Type"
, "Content-Length"
and "ETag"
,
for which the convenience methods getContentType()
, getContentLength()
and #getModificationTime()
exist.null
public java.lang.String toString()
toString
in class java.lang.Object