com.trolltech.qt.network
Class QNetworkRequest

java.lang.Object
  extended by com.trolltech.qt.internal.QSignalEmitterInternal
      extended by com.trolltech.qt.QSignalEmitter
          extended by com.trolltech.qt.QtJambiObject
              extended by com.trolltech.qt.network.QNetworkRequest
All Implemented Interfaces:
QtJambiInterface, java.lang.Cloneable

public class QNetworkRequest
extends QtJambiObject
implements java.lang.Cloneable

The QNetworkRequest class holds one request to be sent with the Network Access API. QNetworkRequest is part of the Network Access API and is the class holding the information necessary to send a request over the network. It contains a URL and some ancillary information that can be used to modify the request.

See also:
QNetworkReply, and QNetworkAccessManager.


Nested Class Summary
static class QNetworkRequest.Attribute
          Attribute codes for the QNetworkRequest and QNetworkReply.
static class QNetworkRequest.CacheLoadControl
          Controls the caching mechanism of QNetworkAccessManager.
static class QNetworkRequest.KnownHeaders
          List of known header types that QNetworkRequest parses.
 
Nested classes/interfaces inherited from class com.trolltech.qt.QSignalEmitter
QSignalEmitter.AbstractSignal, QSignalEmitter.PrivateSignal0, QSignalEmitter.PrivateSignal1, QSignalEmitter.PrivateSignal2, QSignalEmitter.PrivateSignal3, QSignalEmitter.PrivateSignal4, QSignalEmitter.PrivateSignal5, QSignalEmitter.PrivateSignal6, QSignalEmitter.PrivateSignal7, QSignalEmitter.PrivateSignal8, QSignalEmitter.PrivateSignal9, 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
QNetworkRequest()
          Constructs a QNetworkRequest object with url as the URL to be requested.
QNetworkRequest(QNetworkRequest other)
          Creates a copy of other.
QNetworkRequest(QUrl url)
          Constructs a QNetworkRequest object with url as the URL to be requested.
 
Method Summary
 java.lang.Object attribute(QNetworkRequest.Attribute code)
          Returns the attribute associated with the code code.
 java.lang.Object attribute(QNetworkRequest.Attribute code, java.lang.Object defaultValue)
          Returns the attribute associated with the code code.
 QNetworkRequest clone()
          This method is reimplemented for internal reasons
 boolean hasRawHeader(QByteArray headerName)
          Returns true if the raw header headerName is present in this network request.
 java.lang.Object header(QNetworkRequest.KnownHeaders header)
          Returns the value of the known network header header if it is present in this request.
 QByteArray rawHeader(QByteArray headerName)
          Returns the raw form of header headerName.
 java.util.List rawHeaderList()
          Returns a list of all raw headers that are set in this network request.
 void setAttribute(QNetworkRequest.Attribute code, java.lang.Object value)
          Sets the attribute associated with code code to be value value.
 void setHeader(QNetworkRequest.KnownHeaders header, java.lang.Object value)
          Sets the value of the known header header to be value, overriding any previously set headers.
 void setRawHeader(QByteArray headerName, QByteArray value)
          Sets the header headerName to be of value headerValue.
 void setSslConfiguration(QSslConfiguration configuration)
          Sets this network request's SSL configuration to be config.
 void setUrl(QUrl url)
          Sets the URL this network request is referring to to be url.
 QSslConfiguration sslConfiguration()
          Returns this network request's SSL configuration.
 QUrl url()
          Returns the URL this network request is referring to.
 
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
getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.trolltech.qt.QtJambiInterface
disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership
 

Constructor Detail

QNetworkRequest

public QNetworkRequest(QNetworkRequest other)
Creates a copy of other.


QNetworkRequest

public QNetworkRequest()
Constructs a QNetworkRequest object with url as the URL to be requested.

See also:
url(), and setUrl().


QNetworkRequest

public QNetworkRequest(QUrl url)
Constructs a QNetworkRequest object with url as the URL to be requested.

See also:
url(), and setUrl().

Method Detail

attribute

public final java.lang.Object attribute(QNetworkRequest.Attribute code)
Returns the attribute associated with the code code. If the attribute has not been set, it returns defaultValue.

Note: this function does not apply the defaults listed in QNetworkRequest::Attribute .

See also:
setAttribute(), and QNetworkRequest::Attribute .


attribute

public final java.lang.Object attribute(QNetworkRequest.Attribute code,
                                        java.lang.Object defaultValue)
Returns the attribute associated with the code code. If the attribute has not been set, it returns defaultValue.

Note: this function does not apply the defaults listed in QNetworkRequest::Attribute .

See also:
setAttribute(), and QNetworkRequest::Attribute .


hasRawHeader

public final boolean hasRawHeader(QByteArray headerName)
Returns true if the raw header headerName is present in this network request.

See also:
rawHeader(), and setRawHeader().


header

public final java.lang.Object header(QNetworkRequest.KnownHeaders header)
Returns the value of the known network header header if it is present in this request. If it is not present, returns QVariant() (i.e., an invalid variant).

See also:
KnownHeaders , rawHeader(), and setHeader().


rawHeader

public final QByteArray rawHeader(QByteArray headerName)
Returns the raw form of header headerName. If no such header is present, an empty QByteArray is returned, which may be indistinguishable from a header that is present but has no content (use hasRawHeader() to find out if the header exists or not).

Raw headers can be set with setRawHeader() or with setHeader().

See also:
header(), and setRawHeader().


rawHeaderList

public final java.util.List rawHeaderList()
Returns a list of all raw headers that are set in this network request. The list is in the order that the headers were set.

See also:
hasRawHeader(), and rawHeader().


setAttribute

public final void setAttribute(QNetworkRequest.Attribute code,
                               java.lang.Object value)
Sets the attribute associated with code code to be value value. If the attribute is already set, the previous value is discarded. In special, if value is an invalid QVariant, the attribute is unset.

See also:
attribute(), and QNetworkRequest::Attribute .


setHeader

public final void setHeader(QNetworkRequest.KnownHeaders header,
                            java.lang.Object value)
Sets the value of the known header header to be value, overriding any previously set headers. This operation also sets the equivalent raw HTTP header.

See also:
KnownHeaders , setRawHeader(), and header().


setRawHeader

public final void setRawHeader(QByteArray headerName,
                               QByteArray value)
Sets the header headerName to be of value headerValue. If headerName corresponds to a known header (see QNetworkRequest::KnownHeaders ), the raw format will be parsed and the corresponding "cooked" header will be set as well.

For example:

The following code example is written in c++.

request.setRawHeader("Last-Modified", "Sun, 06 Nov 1994 08:49:37 GMT");
will also set the known header LastModifiedHeader to be the QDateTime object of the parsed date.

Note: setting the same header twice overrides the previous setting. To accomplish the behaviour of multiple HTTP headers of the same name, you should concatenate the two values, separating them with a comma (",") and set one single raw header.

See also:
KnownHeaders , setHeader(), hasRawHeader(), and rawHeader().


setSslConfiguration

public final void setSslConfiguration(QSslConfiguration configuration)
Sets this network request's SSL configuration to be config. The settings that apply are the private key, the local certificate, the SSL protocol (SSLv2, SSLv3, TLSv1 where applicable) and the ciphers that the SSL backend is allowed to use.

By default, no SSL configuration is set, which allows the backends to choose freely what configuration is best for them.

See also:
sslConfiguration(), and QSslConfiguration::defaultConfiguration().


setUrl

public final void setUrl(QUrl url)
Sets the URL this network request is referring to to be url.

See also:
url().


sslConfiguration

public final QSslConfiguration sslConfiguration()
Returns this network request's SSL configuration. By default, no SSL settings are specified.

See also:
setSslConfiguration().


url

public final QUrl url()
Returns the URL this network request is referring to.

See also:
setUrl().


clone

public QNetworkRequest clone()
This method is reimplemented for internal reasons

Overrides:
clone in class java.lang.Object