|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.trolltech.qt.internal.QSignalEmitterInternal
com.trolltech.qt.QSignalEmitter
com.trolltech.qt.QtJambiObject
com.trolltech.qt.core.QObject
com.trolltech.qt.network.QNetworkCookieJar
public class QNetworkCookieJar
The QNetworkCookieJar
class implements a simple jar of QNetworkCookie
objects Cookies are small bits of information that stateless protocols like HTTP use to maintain some persistent information across requests.
A cookie is set by a remote server when it replies to a request and it expects the same cookie to be sent back when further requests are sent.
The cookie jar is the object that holds all cookies set in previous requests. Web browsers save their cookie jars to disk in order to conserve permanent cookies across invocations of the application.
QNetworkCookieJar
does not implement permanent storage: it only keeps the cookies in memory. Once the QNetworkCookieJar
object is deleted, all cookies it held will be discarded as well. If you want to save the cookies, you should derive from this class and implement the saving to disk to your own storage format.
This class implements only the basic security recommended by the cookie specifications and does not implement any cookie acceptance policy (it accepts all cookies set by any requests). In order to override those rules, you should reimplement the cookiesForUrl()
and setCookiesFromUrl()
virtual functions. They are called by QNetworkReply
and QNetworkAccessManager
when they detect new cookies and when they require cookies.
QNetworkCookie
, QNetworkAccessManager
, QNetworkReply
, QNetworkRequest
, and QNetworkAccessManager::setCookieJar()
.
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 | |
---|---|
QNetworkCookieJar()
Creates a QNetworkCookieJar object and sets the parent object to be parent. |
|
QNetworkCookieJar(QObject parent)
Creates a QNetworkCookieJar object and sets the parent object to be parent. |
Method Summary | |
---|---|
protected java.util.List |
allCookies()
Returns all cookies stored in this cookie jar. |
java.util.List |
cookiesForUrl(QUrl url)
Returns the cookies to be added to when a request is sent to url. |
protected void |
setAllCookies(java.util.List cookieList)
Sets the internal list of cookies held by this cookie jar to be cookieList. |
boolean |
setCookiesFromUrl(java.util.List cookieList,
QUrl url)
Adds the cookies in the list cookieList to this cookie jar. |
Methods inherited from class com.trolltech.qt.core.QObject |
---|
childEvent, children, connectSlotsByName, customEvent, disposeLater, dumpObjectInfo, dumpObjectTree, dynamicPropertyNames, event, eventFilter, findChild, findChild, findChild, findChildren, findChildren, findChildren, findChildren, indexOfProperty, installEventFilter, isWidgetType, killTimer, moveToThread, objectName, parent, properties, property, removeEventFilter, setObjectName, setParent, setProperty, startTimer, timerEvent, toString, userProperty |
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 |
---|
public QNetworkCookieJar()
QNetworkCookieJar
object and sets the parent object to be parent. The cookie jar is initialized to empty.
public QNetworkCookieJar(QObject parent)
QNetworkCookieJar
object and sets the parent object to be parent. The cookie jar is initialized to empty.
Method Detail |
---|
protected final java.util.List allCookies()
setAllCookies()
, and cookiesForUrl()
.
protected final void setAllCookies(java.util.List cookieList)
setCookiesFromUrl()
. allCookies()
, and setCookiesFromUrl()
.
public java.util.List cookiesForUrl(QUrl url)
QNetworkAccessManager::createRequest()
, which adds the cookies returned by this function to the request being sent. If more than one cookie with the same name is found, but with differing paths, the one with longer path is returned before the one with shorter path. In other words, this function returns cookies sorted by path length.
The default QNetworkCookieJar
class implements only a very basic security policy (it makes sure that the cookies' domain and path match the reply's). To enhance the security policy with your own algorithms, override cookiesForUrl()
.
setCookiesFromUrl()
, and QNetworkAccessManager::setCookieJar()
.
public boolean setCookiesFromUrl(java.util.List cookieList, QUrl url)
Returns true if one or more cookes are set for url otherwise false.
If a cookie already exists in the cookie jar, it will be overridden by those in cookieList.
The default QNetworkCookieJar
class implements only a very basic security policy (it makes sure that the cookies' domain and path match the reply's). To enhance the security policy with your own algorithms, override setCookiesFromUrl()
.
Also, QNetworkCookieJar
does not have a maximum cookie jar size. Reimplement this function to discard older cookies to create room for new ones.
cookiesForUrl()
, and QNetworkAccessManager::setCookieJar()
.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |