<class name="QHttpHeader" doc="/** <p>The <a href="QHttpHeader.html#QHttpHeader()"><tt>QHttpHeader</tt></a> class contains header information for HTTP.</p> <p>In most cases you should use the more specialized derivatives of this class, <a href="QHttpResponseHeader.html"><tt>QHttpResponseHeader</tt></a> and <a href="QHttpRequestHeader.html"><tt>QHttpRequestHeader</tt></a>, rather than directly using <a href="QHttpHeader.html#QHttpHeader()"><tt>QHttpHeader</tt></a>.</p> <p><a href="QHttpHeader.html#QHttpHeader()"><tt>QHttpHeader</tt></a> 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:</p> <pre> content-type: text/html</pre> <p>In the API the header field name is called the &quot;key&quot; and the content is called the &quot;value&quot;. You can get and set a header field's value by using its key with <a href="QHttpHeader.html#value(java.lang.String)"><tt>value</tt></a> and <a href="QHttpHeader.html#setValue(java.lang.String, java.lang.String)"><tt>setValue</tt></a>, e.g&#x2e;</p> <pre> header.setValue(&quot;content-type&quot;, &quot;text/html&quot;); QString contentType = header.value(&quot;content-type&quot;);</pre> <p>Some fields are so common that getters and setters are provided for them as a convenient alternative to using <a href="QHttpHeader.html#value(java.lang.String)"><tt>value</tt></a> and <a href="QHttpHeader.html#setValue(java.lang.String, java.lang.String)"><tt>setValue</tt></a>, e.g&#x2e; <a href="QHttpHeader.html#contentLength()"><tt>contentLength</tt></a> and <a href="QHttpHeader.html#contentType()"><tt>contentType</tt></a>, <a href="QHttpHeader.html#setContentLength(int)"><tt>setContentLength</tt></a> and <a href="QHttpHeader.html#setContentType(java.lang.String)"><tt>setContentType</tt></a>.</p> <p>Each header key has a <i>single</i> value associated with it. If you set the value for a key which already exists the previous value will be discarded.</p> @see <a href="QHttpRequestHeader.html"><tt>QHttpRequestHeader</tt></a> @see <a href="QHttpResponseHeader.html"><tt>QHttpResponseHeader</tt></a> */"> <method name="public QHttpHeader(com.trolltech.qt.network.QHttpHeader header)" doc="/** <p>Constructs a copy of <tt>header</tt>.</p> */"/> <method name="public QHttpHeader(java.lang.String str)" doc="/** <p>Constructs a HTTP header for <tt>str</tt>.</p> <p>This constructor parses the string <tt>str</tt> for header fields and adds this information. The <tt>str</tt> should consist of one or more &quot;\r\n&quot; delimited lines; each of these lines should have the format key, colon, space, value.</p> */"/> <method name="public QHttpHeader()" doc="/** <p>Constructs an empty HTTP header.</p> */"/> <method name="public final void addValue(java.lang.String key, java.lang.String value)" doc="/** <p>Adds a new entry with the <tt>key</tt> and <tt>value</tt>.</p> */"/> <method name="public final java.util.List<java.lang.String> allValues(java.lang.String key)" doc="/** <p>Returns all the entries with the given <tt>key</tt>. If no entry has this <tt>key</tt>, an empty string list is returned.</p> */"/> <method name="public final int contentLength()" doc="/** <p>Returns the value of the special HTTP header field <tt>content-length</tt>.</p> @see <a href="QHttpHeader.html#setContentLength(int)"><tt>setContentLength</tt></a> @see <a href="QHttpHeader.html#hasContentLength()"><tt>hasContentLength</tt></a> */"/> <method name="public final java.lang.String contentType()" doc="/** <p>Returns the value of the special HTTP header field <tt>content-type</tt>.</p> @see <a href="QHttpHeader.html#setContentType(java.lang.String)"><tt>setContentType</tt></a> @see <a href="QHttpHeader.html#hasContentType()"><tt>hasContentType</tt></a> */"/> <method name="public final boolean hasContentLength()" doc="/** <p>Returns true if the header has an entry for the special HTTP header field <tt>content-length</tt>; otherwise returns false.</p> @see <a href="QHttpHeader.html#contentLength()"><tt>contentLength</tt></a> @see <a href="QHttpHeader.html#setContentLength(int)"><tt>setContentLength</tt></a> */"/> <method name="public final boolean hasContentType()" doc="/** <p>Returns true if the header has an entry for the the special HTTP header field <tt>content-type</tt>; otherwise returns false.</p> @see <a href="QHttpHeader.html#contentType()"><tt>contentType</tt></a> @see <a href="QHttpHeader.html#setContentType(java.lang.String)"><tt>setContentType</tt></a> */"/> <method name="public final boolean hasKey(java.lang.String key)" doc="/** <p>Returns true if the HTTP header has an entry with the given <tt>key</tt>; otherwise returns false.</p> @see <a href="QHttpHeader.html#value(java.lang.String)"><tt>value</tt></a> @see <a href="QHttpHeader.html#setValue(java.lang.String, java.lang.String)"><tt>setValue</tt></a> @see <a href="QHttpHeader.html#keys()"><tt>keys</tt></a> */"/> <method name="public final boolean isValid()" doc="/** <p>Returns true if the HTTP header is valid; otherwise returns false.</p> <p>A <a href="QHttpHeader.html#QHttpHeader()"><tt>QHttpHeader</tt></a> is invalid if it was created by parsing a malformed string.</p> */"/> <method name="public final java.util.List<java.lang.String> keys()" doc="/** <p>Returns a list of the keys in the HTTP header.</p> @see <a href="QHttpHeader.html#hasKey(java.lang.String)"><tt>hasKey</tt></a> */"/> <method name="protected final boolean parse(java.lang.String str)" doc="/** <p>This method is used internally by Qt Jambi. Do not use it in your applications.</p> @see <a href="QHttpHeader.html#toString()"><tt>toString</tt></a> */"/> <method name="public final void removeAllValues(java.lang.String key)" doc="/** <p>Removes all the entries with the key <tt>key</tt> from the HTTP header.</p> */"/> <method name="public final void removeValue(java.lang.String key)" doc="/** <p>Removes the entry with the key <tt>key</tt> from the HTTP header.</p> @see <a href="QHttpHeader.html#value(java.lang.String)"><tt>value</tt></a> @see <a href="QHttpHeader.html#setValue(java.lang.String, java.lang.String)"><tt>setValue</tt></a> */"/> <method name="public final void setContentLength(int len)" doc="/** <p>Sets the value of the special HTTP header field <tt>content-length</tt> to <tt>len</tt>.</p> @see <a href="QHttpHeader.html#contentLength()"><tt>contentLength</tt></a> @see <a href="QHttpHeader.html#hasContentLength()"><tt>hasContentLength</tt></a> */"/> <method name="public final void setContentType(java.lang.String type)" doc="/** <p>Sets the value of the special HTTP header field <tt>content-type</tt> to <tt>type</tt>.</p> @see <a href="QHttpHeader.html#contentType()"><tt>contentType</tt></a> @see <a href="QHttpHeader.html#hasContentType()"><tt>hasContentType</tt></a> */"/> <method name="protected final void setValid(boolean arg__1)" doc="/** <p>This method is used internally by Qt Jambi. Do not use it in your applications.</p> @see <a href="QHttpHeader.html#isValid()"><tt>isValid</tt></a> */"/> <method name="public final void setValue(java.lang.String key, java.lang.String value)" doc="/** <p>Sets the value of the entry with the <tt>key</tt> to <tt>value</tt>.</p> <p>If no entry with <tt>key</tt> exists, a new entry with the given <tt>key</tt> and <tt>value</tt> is created. If an entry with the <tt>key</tt> already exists, the first value is discarded and replaced with the given <tt>value</tt>.</p> @see <a href="QHttpHeader.html#value(java.lang.String)"><tt>value</tt></a> @see <a href="QHttpHeader.html#hasKey(java.lang.String)"><tt>hasKey</tt></a> @see <a href="QHttpHeader.html#removeValue(java.lang.String)"><tt>removeValue</tt></a> */"/> <method name="public final void setValues(java.lang.String>> values)" doc="/** <p>Sets the header entries to be the list of key value pairs in <tt>values</tt>.</p> @see <a href="QHttpHeader.html#values()"><tt>values</tt></a> */"/> <method name="public final java.lang.String value(java.lang.String key)" doc="/** <p>Returns the first value for the entry with the given <tt>key</tt>. If no entry has this <tt>key</tt>, an empty string is returned.</p> @see <a href="QHttpHeader.html#setValue(java.lang.String, java.lang.String)"><tt>setValue</tt></a> @see <a href="QHttpHeader.html#removeValue(java.lang.String)"><tt>removeValue</tt></a> @see <a href="QHttpHeader.html#hasKey(java.lang.String)"><tt>hasKey</tt></a> @see <a href="QHttpHeader.html#keys()"><tt>keys</tt></a> */"/> <method name="public final java.util.List<com.trolltech.qt.QPair<java.lang.String, java.lang.String>> values()" doc="/** <p>Returns all the entries in the header.</p> @see <a href="QHttpHeader.html#setValues(java.lang.String>>)"><tt>setValues</tt></a> */"/> <method name="public abstract int majorVersion()" doc="/** <p>Returns the major protocol-version of the HTTP header.</p> */"/> <method name="public abstract int minorVersion()" doc="/** <p>Returns the minor protocol-version of the HTTP header.</p> */"/> <method name="protected boolean parseLine(java.lang.String line, int number)" doc="/** <p>This method is used internally by Qt Jambi. Do not use it in your applications.</p> @see <a href="QHttpHeader.html#parse(java.lang.String)"><tt>parse</tt></a> */"/> <method name="public java.lang.String toString()" doc="/** <p>Returns a string representation of the HTTP header.</p> <p>The string is suitable for use by the constructor that takes a <a href="%2E%2E/porting4.html#qstring"><tt>QString</tt></a>. It consists of lines with the format: key, colon, space, value, &quot;\r\n&quot;.</p> */"/> </class>