Package com.luciad.io.transport
Class TLcdTransportResponse
java.lang.Object
com.luciad.io.transport.TLcdTransportResponse
A response from a transport service.
- Since:
- 11.0
-
Constructor Summary
ConstructorDescriptionTLcdTransportResponse
(int aResponseCode, String aResponseReason, ReadableByteChannel aContent, List<TLcdPair<String, String>> aHeaders) Constructs a response. -
Method Summary
Modifier and TypeMethodDescriptionGets the content for this response as a channel.long
Gets the content length in bytes of this response's content.Gets the content type (MIME type) of this response's content.Gets the headers for this response.int
Gets the HTTP response code (status code).Gets the HTTP response reason (reason phrase), corresponding togetResponseCode()
.toString()
-
Constructor Details
-
TLcdTransportResponse
public TLcdTransportResponse(int aResponseCode, String aResponseReason, ReadableByteChannel aContent, List<TLcdPair<String, String>> aHeaders) Constructs a response.- Parameters:
aResponseCode
- an HTTP response code, for example404
aResponseReason
- an HTTP reason phrase corresponding to the response code, for instance"Not Found"
corresponding to404
, may benull
aContent
- a channel providing access to the content, may benull
aHeaders
- a list of headers, may be empty but notnull
. Headers typically filled in by an LTS server are"Content-Type"
,"Content-Length"
and"ETag"
. The latter can be used for a conditionalGET
later on.
-
-
Method Details
-
getResponseCode
public int getResponseCode()Gets the HTTP response code (status code). The response code indicates whether the request was successful or not. Response codes are defined in the HTTP 1.1 spec.- Returns:
- the HTTP response code
-
getResponseReason
Gets the HTTP response reason (reason phrase), corresponding togetResponseCode()
. This represents a human-readable form of the response code.- Returns:
- the HTTP response reason
-
getContentType
Gets the content type (MIME type) of this response's content.- Returns:
- the content type (MIME type), possibly
null
-
getContentLength
public long getContentLength()Gets the content length in bytes of this response's content. If unspecified, this method will return-1
. Note that the content length is optional, so even if the content length is unspecified, the content may still have non-zero length.- Returns:
- the content length, possibly
-1
if unspecified
-
getContent
Gets the content for this response as a channel.- Returns:
- a channel providing access to the content, possibly
null
-
getHeaders
Gets the headers for this response. Headers are defined in the HTTP 1.1 specification. Typical headers are"Content-Type"
,"Content-Length"
and"ETag"
, for which the convenience methodsgetContentType()
,getContentLength()
and#getModificationTime()
exist.- Returns:
- a list of headers, possibly empty but never
null
-
toString
-