public class TLcdTransportResponse extends Object
Constructor and Description |
---|
TLcdTransportResponse(int aResponseCode,
String aResponseReason,
ReadableByteChannel aContent,
List<TLcdPair<String,String>> aHeaders)
Constructs a response.
|
Modifier and Type | Method and Description |
---|---|
ReadableByteChannel |
getContent()
Gets the content for this response as a channel.
|
long |
getContentLength()
Gets the content length in bytes of this response's content.
|
String |
getContentType()
Gets the content type (MIME type) of this response's content.
|
List<TLcdPair<String,String>> |
getHeaders()
Gets the headers for this response.
|
int |
getResponseCode()
Gets the HTTP response code (status code).
|
String |
getResponseReason()
Gets the HTTP response reason (reason phrase), corresponding to
getResponseCode() . |
String |
toString() |
public TLcdTransportResponse(int aResponseCode, String aResponseReason, ReadableByteChannel aContent, List<TLcdPair<String,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 String getResponseReason()
getResponseCode()
.
This represents a human-readable form of the response code.public 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 ReadableByteChannel getContent()
null
public List<TLcdPair<String,String>> getHeaders()
"Content-Type"
, "Content-Length"
and "ETag"
,
for which the convenience methods getContentType()
, getContentLength()
and #getModificationTime()
exist.null