Class TLcdTransportResponse

java.lang.Object
com.luciad.io.transport.TLcdTransportResponse

public class TLcdTransportResponse extends Object
A response from a transport service.
Since:
11.0
  • 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 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.
  • 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

      public String getResponseReason()
      Gets the HTTP response reason (reason phrase), corresponding to getResponseCode(). This represents a human-readable form of the response code.
      Returns:
      the HTTP response reason
    • getContentType

      public String 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

      public ReadableByteChannel getContent()
      Gets the content for this response as a channel.
      Returns:
      a channel providing access to the content, possibly null
    • getHeaders

      public List<TLcdPair<String,String>> 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 methods getContentType(), getContentLength() and #getModificationTime() exist.
      Returns:
      a list of headers, possibly empty but never null
    • toString

      public String toString()
      Overrides:
      toString in class Object