cfboom.http

Interface HttpMessage

cfboom.http.HttpMessage
All Known Implementing Classes:
AbstractHttpMessage , BasicHttpRequest , BasicHttpResponse
All Known Subinterfaces:
HttpRequest , HttpResponse

HTTP messages head consisting of multiple message headers.

Class Attributes:
  • cfboom : Joel Tobey
  •  
  • displayname : Interface HttpMessage
  •  
    Method Summary
    void addHeader([string name], [string value])
         Adds a header to this message.
    boolean containsHeader([string name])
         Checks if a certain header is present in this message.
    array getAllHeaders()
         Returns all the headers of this message.
    string getContentEncoding()
         Obtains the Content-Encoding header, if known.
    numeric getContentLength()
         Tells the length of the content, if known.
    string getContentType()
         Obtains the Content-Type header, if known.
    string getFirstHeader([string name])
         Returns the first header with a specified name of this message.
    array getHeaders([string name])
         Returns all the headers with a specified name of this message.
    string getLastHeader([string name])
         Returns the last header with a specified name of this message.
    void removeHeaders([string name])
         Removes all headers with a certain name from this message.
    void setHeader([string name], [string value])
         Overwrites the first header with the same name.
    void setHeaders([array headers])
         Overwrites all the headers in the message.

    Method Detail

    addHeader

    public void addHeader([string name], [string value])

    Adds a header to this message. The header will be appended to the end of the list.

    Parameters:
    name - the name of the header.
    value - the value of the header.

    containsHeader

    public boolean containsHeader([string name])

    Checks if a certain header is present in this message. Header values are ignored.

    Parameters:
    name
    Returns:
    true if at least one header with this name is present.

    getAllHeaders

    public array getAllHeaders()

    Returns all the headers of this message. Headers are orderd in the sequence they will be sent over a connection.

    Returns:
    all the headers of this message

    getContentEncoding

    public string getContentEncoding()

    Obtains the Content-Encoding header, if known. This is the header that should be used when sending the entity, or the one that was received with the entity. Wrapping entities that modify the content encoding should adjust this header accordingly. {@code null} if the content encoding is unknown

    Returns:
    the Content-Encoding header for this entity, or

    getContentLength

    public numeric getContentLength()

    Tells the length of the content, if known. a negative number if unknown. If the content length is known but exceeds {@link java.lang.Long#MAX_VALUE Long.MAX_VALUE}, a negative number is returned.

    Returns:
    the number of bytes of the content, or

    getContentType

    public string getContentType()

    Obtains the Content-Type header, if known. This is the header that should be used when sending the entity, or the one that was received with the entity. It can include a charset attribute. {@code null} if the content type is unknown

    Returns:
    the Content-Type header for this entity, or

    getFirstHeader

    public string getFirstHeader([string name])

    Returns the first header with a specified name of this message. Header values are ignored. If there is more than one matching header in the message the first element of {@link #getHeaders(String)} is returned. If there is no matching header in the message {@code null} is returned. or {@code null} if no such header could be found.

    Parameters:
    name
    Returns:
    the first header whose name property equals {@code name}

    getHeaders

    public array getHeaders([string name])

    Returns all the headers with a specified name of this message. Header values are ignored. Headers are orderd in the sequence they will be sent over a connection.

    Parameters:
    name
    Returns:
    the headers whose name property equals {@code name}.

    getLastHeader

    public string getLastHeader([string name])

    Returns the last header with a specified name of this message. Header values are ignored. If there is more than one matching header in the message the last element of {@link #getHeaders(String)} is returned. If there is no matching header in the message {@code null} is returned. or {@code null} if no such header could be found.

    Parameters:
    name
    Returns:
    the last header whose name property equals {@code name}.

    removeHeaders

    public void removeHeaders([string name])

    Removes all headers with a certain name from this message.

    Parameters:
    name - The name of the headers to remove.

    setHeader

    public void setHeader([string name], [string value])

    Overwrites the first header with the same name. The new header will be appended to the end of the list, if no header with the given name can be found.

    Parameters:
    name - the name of the header.
    value - the value of the header.

    setHeaders

    public void setHeaders([array headers])

    Overwrites all the headers in the message.

    Parameters:
    headers - the array of headers to set.