Package kilim.http

Class HttpResponse


  • public class HttpResponse
    extends HttpMsg
    The response object encapsulates the header and often, but not always, the content. The caller must set all the fields, except for the protocol, server and date. The body of the response (the content) is written to a stream obtained from getOutputStream().
    • Field Detail

      • ST_CONTINUE

        public static final byte[] ST_CONTINUE
      • ST_SWITCHING_PROTOCOLS

        public static final byte[] ST_SWITCHING_PROTOCOLS
      • ST_OK

        public static final byte[] ST_OK
      • ST_CREATED

        public static final byte[] ST_CREATED
      • ST_ACCEPTED

        public static final byte[] ST_ACCEPTED
      • ST_NON_AUTHORITATIVE

        public static final byte[] ST_NON_AUTHORITATIVE
      • ST_NO_CONTENT

        public static final byte[] ST_NO_CONTENT
      • ST_RESET_CONTENT

        public static final byte[] ST_RESET_CONTENT
      • ST_PARTIAL_CONTENT

        public static final byte[] ST_PARTIAL_CONTENT
      • ST_MULTIPLE_CHOICES

        public static final byte[] ST_MULTIPLE_CHOICES
      • ST_MOVED_PERMANENTLY

        public static final byte[] ST_MOVED_PERMANENTLY
      • ST_FOUND

        public static final byte[] ST_FOUND
      • ST_SEE_OTHER

        public static final byte[] ST_SEE_OTHER
      • ST_NOT_MODIFIED

        public static final byte[] ST_NOT_MODIFIED
      • ST_USE_PROXY

        public static final byte[] ST_USE_PROXY
      • ST_TEMPORARY_REDIRECT

        public static final byte[] ST_TEMPORARY_REDIRECT
      • ST_BAD_REQUEST

        public static final byte[] ST_BAD_REQUEST
      • ST_UNAUTHORIZED

        public static final byte[] ST_UNAUTHORIZED
      • ST_PAYMENT_REQUIRED

        public static final byte[] ST_PAYMENT_REQUIRED
      • ST_FORBIDDEN

        public static final byte[] ST_FORBIDDEN
      • ST_NOT_FOUND

        public static final byte[] ST_NOT_FOUND
      • ST_METHOD_NOT_ALLOWED

        public static final byte[] ST_METHOD_NOT_ALLOWED
      • ST_NOT_ACCEPTABLE

        public static final byte[] ST_NOT_ACCEPTABLE
      • ST_PROXY_AUTHENTICATION_REQUIRED

        public static final byte[] ST_PROXY_AUTHENTICATION_REQUIRED
      • ST_REQUEST_TIMEOUT

        public static final byte[] ST_REQUEST_TIMEOUT
      • ST_CONFLICT

        public static final byte[] ST_CONFLICT
      • ST_GONE

        public static final byte[] ST_GONE
      • ST_LENGTH_REQUIRED

        public static final byte[] ST_LENGTH_REQUIRED
      • ST_PRECONDITION_FAILED

        public static final byte[] ST_PRECONDITION_FAILED
      • ST_REQUEST_ENTITY_TOO_LARGE

        public static final byte[] ST_REQUEST_ENTITY_TOO_LARGE
      • ST_REQUEST_URI_TOO_LONG

        public static final byte[] ST_REQUEST_URI_TOO_LONG
      • ST_UNSUPPORTED_MEDIA_TYPE

        public static final byte[] ST_UNSUPPORTED_MEDIA_TYPE
      • ST_REQUEST_RANGE_NOT_SATISFIABLE

        public static final byte[] ST_REQUEST_RANGE_NOT_SATISFIABLE
      • ST_EXPECTATION_FAILED

        public static final byte[] ST_EXPECTATION_FAILED
      • ST_TEAPOT

        public static final byte[] ST_TEAPOT
      • ST_INTERNAL_SERVER_ERROR

        public static final byte[] ST_INTERNAL_SERVER_ERROR
      • ST_NOT_IMPLEMENTED

        public static final byte[] ST_NOT_IMPLEMENTED
      • ST_BAD_GATEWAY

        public static final byte[] ST_BAD_GATEWAY
      • ST_SERVICE_UNAVAILABLE

        public static final byte[] ST_SERVICE_UNAVAILABLE
      • ST_GATEWAY_TIMEOUT

        public static final byte[] ST_GATEWAY_TIMEOUT
      • ST_HTTP_VERSION_NOT_SUPPORTED

        public static final byte[] ST_HTTP_VERSION_NOT_SUPPORTED
      • PROTOCOL

        public static final byte[] PROTOCOL
      • F_SERVER

        public static final byte[] F_SERVER
      • F_DATE

        public static final byte[] F_DATE
      • CRLF

        public static final byte[] CRLF
      • FIELD_SEP

        public static final byte[] FIELD_SEP
      • byteCache

        public static java.util.concurrent.ConcurrentHashMap<java.lang.String,​byte[]> byteCache
      • status

        public byte[] status
        The status line for the response. Can use any of the predefined strings in HttpResponse.ST_*.
      • keys

        public java.util.ArrayList<java.lang.String> keys
      • values

        public java.util.ArrayList<java.lang.String> values
      • gmtdf

        public static final java.text.SimpleDateFormat gmtdf
    • Constructor Detail

      • HttpResponse

        public HttpResponse()
      • HttpResponse

        public HttpResponse​(byte[] statusb)
      • HttpResponse

        public HttpResponse​(java.lang.String statusMsg)
    • Method Detail

      • reuse

        public void reuse()
      • setStatus

        public void setStatus​(java.lang.String statusMsg)
      • addField

        public HttpResponse addField​(java.lang.String key,
                                     java.lang.String value)
      • getHeaderValue

        public java.lang.String getHeaderValue​(java.lang.String key)
      • writeHeader

        public void writeHeader​(java.io.OutputStream os)
                         throws java.io.IOException
        Throws:
        java.io.IOException
      • getOutputStream

        public java.io.OutputStream getOutputStream()
      • writeTo

        public void writeTo​(EndPoint endpoint)
                     throws java.io.IOException,
                            Pausable
        Throws:
        java.io.IOException
        Pausable
      • setContentLength

        public void setContentLength​(long length)
      • setContentType

        public void setContentType​(java.lang.String contentType)