Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.trolltech.qt.network
Class QHttpHeader

    java.lang.Object
      com.trolltech.qt.internal.QSignalEmitterInternal
          com.trolltech.qt.QSignalEmitter
              com.trolltech.qt.QtJambiObject
                  com.trolltech.qt.network.QHttpHeader

All Implemented Interfaces:
  QtJambiInterface

Direct Known Subclasses:
  QHttpRequestHeader, QHttpResponseHeader

    public abstract class QHttpHeader

extends QtJambiObject

The `QHttpHeader` class contains header information for HTTP. In most cases you should use the more specialized derivatives of this class, `QHttpResponseHeader` and `QHttpRequestHeader`, rather than directly using `QHttpHeader`.

`QHttpHeader` provides the HTTP header fields. A HTTP header field consists of a name followed by a colon, a single space, and the field value. (See RFC 1945.) Field names are case-insensitive. A typical header field looks like this:

        content-type: text/html

In the API the header field name is called the "key" and the content is called the "value". You can get and set a header field's value by using its key with `value()` and `setValue()`, e.g.

        header.setValue("content-type", "text/html");
        StringscontentType = header.value("content-type");

Some fields are so common that getters and setters are provided for them as a convenient alternative to using `value()` and `setValue()`, e.g. `contentLength()` and `contentType()`, `setContentLength()` and `setContentType()`.

Each header key has a single value associated with it. If you set the value for a key which already exists the previous value will be discarded.

See also:
  `QHttpRequestHeader`, and `QHttpResponseHeader`.

Nested Class Summary

Nested classes/interfaces inherited from class com.trolltech.qt.QSignalEmitter
`QSignalEmitter.AbstractSignal, QSignalEmitter.Signal0, QSignalEmitter.Signal1, QSignalEmitter.Signal2, QSignalEmitter.Signal3, QSignalEmitter.Signal4, QSignalEmitter.Signal5, QSignalEmitter.Signal6, QSignalEmitter.Signal7, QSignalEmitter.Signal8, QSignalEmitter.Signal9`

Nested classes/interfaces inherited from class com.trolltech.qt.internal.QSignalEmitterInternal
`com.trolltech.qt.internal.QSignalEmitterInternal.AbstractSignalInternal`

Field Summary

Fields inherited from class com.trolltech.qt.internal.QSignalEmitterInternal
`currentSender`

Constructor Summary
`QHttpHeader()` Constructs an empty HTTP header.
`QHttpHeader(QHttpHeader header)` Constructs a copy of `header`.
`QHttpHeader(java.lang.String str)` Constructs a HTTP header for `str`.

Method Summary
`void` | `addValue(java.lang.String key, java.lang.String value)` Adds a new entry with the `key` and `value`.
`java.util.List` | `allValues(java.lang.String key)` Returns all the entries with the given `key`.
`int` | `contentLength()` Returns the value of the special HTTP header field `content-length`.
`java.lang.String` | `contentType()` Returns the value of the special HTTP header field `content-type`.
`boolean` | `hasContentLength()` Returns true if the header has an entry for the special HTTP header field `content-length`; otherwise returns false.
`boolean` | `hasContentType()` Returns true if the header has an entry for the the special HTTP header field `content-type`; otherwise returns false.
`boolean` | `hasKey(java.lang.String key)` Returns true if the HTTP header has an entry with the given `key`; otherwise returns false.
`boolean` | `isValid()` Returns true if the HTTP header is valid; otherwise returns false.
`java.util.List` | `keys()` Returns a list of the keys in the HTTP header.
`abstract int` | `majorVersion()` Returns the major protocol-version of the HTTP header.
`abstract int` | `minorVersion()` Returns the minor protocol-version of the HTTP header.
`void` | `removeAllValues(java.lang.String key)` Removes all the entries with the key `key` from the HTTP header.
`void` | `removeValue(java.lang.String key)` Removes the entry with the key `key` from the HTTP header.
`void` | `setContentLength(int len)` Sets the value of the special HTTP header field `content-length` to `len`.
`void` | `setContentType(java.lang.String type)` Sets the value of the special HTTP header field `content-type` to `type`.
`void` | `setValue(java.lang.String key, java.lang.String value)` Sets the value of the entry with the `key` to `value`.
`void` | `setValues(java.util.List values)` Sets the header entries to be the list of key value pairs in `values`.
`java.lang.String` | `toString()` Returns a string representation of the `this QHttpHeader`.
`java.lang.String` | `value(java.lang.String key)` Returns the first value for the entry with the given `key`.
`java.util.List` | `values()` Returns all the entries in the header.

Methods inherited from class com.trolltech.qt.QtJambiObject
`dispose, disposed, equals, finalize, reassignNativeResources, tr, tr, tr`

Methods inherited from class com.trolltech.qt.QSignalEmitter
`blockSignals, disconnect, disconnect, signalsBlocked, signalSender, thread`

Methods inherited from class com.trolltech.qt.internal.QSignalEmitterInternal
`__qt_signalInitialization`

Methods inherited from class java.lang.Object
`clone, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Methods inherited from interface com.trolltech.qt.QtJambiInterface
`disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership`

Constructor Detail

### QHttpHeader

    public QHttpHeader()

  Constructs an empty HTTP header.

### QHttpHeader

    public QHttpHeader(QHttpHeader header)

  Constructs a copy of `header`.

### QHttpHeader

    public QHttpHeader(java.lang.String str)

  Constructs a HTTP header for `str`.

  This constructor parses the string `str` for header fields and adds this information. The `str` should consist of one or more "\r\n" delimited lines; each of these lines should have the format key, colon, space, value.

Method Detail

### addValue

    public final void addValue(java.lang.String key,
                               java.lang.String value)

  Adds a new entry with the `key` and `value`.

### allValues

    public final java.util.List allValues(java.lang.String key)

  Returns all the entries with the given `key`. If no entry has this `key`, an empty string list is returned.

### contentLength

    public final int contentLength()

  Returns the value of the special HTTP header field `content-length`.

See also:
  `setContentLength()`, and `hasContentLength()`.

### contentType

    public final java.lang.String contentType()

  Returns the value of the special HTTP header field `content-type`.

See also:
  `setContentType()`, and `hasContentType()`.

### hasContentLength

    public final boolean hasContentLength()

  Returns true if the header has an entry for the special HTTP header field `content-length`; otherwise returns false.

See also:
  `contentLength()`, and `setContentLength()`.

### hasContentType

    public final boolean hasContentType()

  Returns true if the header has an entry for the the special HTTP header field `content-type`; otherwise returns false.

See also:
  `contentType()`, and `setContentType()`.

### hasKey

    public final boolean hasKey(java.lang.String key)

  Returns true if the HTTP header has an entry with the given `key`; otherwise returns false.

See also:
  `value()`, `setValue()`, and `keys()`.

### isValid

    public final boolean isValid()

  Returns true if the HTTP header is valid; otherwise returns false.

  A `QHttpHeader` is invalid if it was created by parsing a malformed string.

### keys

    public final java.util.List keys()

  Returns a list of the keys in the HTTP header.

See also:
  `hasKey()`.

### removeAllValues

    public final void removeAllValues(java.lang.String key)

  Removes all the entries with the key `key` from the HTTP header.

### removeValue

    public final void removeValue(java.lang.String key)

  Removes the entry with the key `key` from the HTTP header.

See also:
  `value()`, and `setValue()`.

### setContentLength

    public final void setContentLength(int len)

  Sets the value of the special HTTP header field `content-length` to `len`.

See also:
  `contentLength()`, and `hasContentLength()`.

### setContentType

    public final void setContentType(java.lang.String type)

  Sets the value of the special HTTP header field `content-type` to `type`.

See also:
  `contentType()`, and `hasContentType()`.

### setValue

    public final void setValue(java.lang.String key,
                               java.lang.String value)

  Sets the value of the entry with the `key` to `value`.

  If no entry with `key` exists, a new entry with the given `key` and `value` is created. If an entry with the `key` already exists, the first value is discarded and replaced with the given `value`.

See also:
  `value()`, `hasKey()`, and `removeValue()`.

### setValues

    public final void setValues(java.util.List values)

  Sets the header entries to be the list of key value pairs in `values`.

### value

    public final java.lang.String value(java.lang.String key)

  Returns the first value for the entry with the given `key`. If no entry has this `key`, an empty string is returned.

See also:
  `setValue()`, `removeValue()`, `hasKey()`, and `keys()`.

### values

    public final java.util.List values()

  Returns all the entries in the header.

See also:
  `setValues()`.

### majorVersion

    public abstract int majorVersion()

  Returns the major protocol-version of the HTTP header.

### minorVersion

    public abstract int minorVersion()

  Returns the minor protocol-version of the HTTP header.

### toString

    public java.lang.String toString()

  Returns a string representation of the `this QHttpHeader`.

  Overrides:
    `toString` in class `java.lang.Object`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD