|
|||||||||
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.network.QNetworkCookie
public class QNetworkCookie
The QNetworkCookie
class holds one network cookie. 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.
QNetworkCookie
holds one such cookie as received from the network. A cookie has a name and a value, but those are opaque to the application (that is, the information stored in them has no meaning to the application). A cookie has an associated path name and domain, which indicate when the cookie should be sent again to the server.
A cookie can also have an expiration date, indicating its validity. If the expiration date is not present, the cookie is considered a "session cookie" and should be discarded when the application exits (or when its concept of session is over).
QNetworkCookie
provides a way of parsing a cookie from the HTTP header format using the QNetworkCookie::parseCookies()
function. However, when received in a QNetworkReply
, the cookie is already parsed.
This class implements cookies as described by the initial cookie specification by Netscape (see http://wp.netscape.com/newsref/std/cookie_spec.html), which is somewhat similar to the RFC 2109 specification. The more recent RFC 2965 specification (which uses the Set-Cookie2 header) is not supported.
QNetworkCookieJar
, QNetworkRequest
, and QNetworkReply
.
Nested Class Summary | |
---|---|
static class |
QNetworkCookie.RawForm
This enum is used with the toRawForm() function to declare which form of a cookie shall be returned. |
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 | |
---|---|
QNetworkCookie()
Create a new QNetworkCookie object, initializing the cookie name to name and its value to value. |
|
QNetworkCookie(QByteArray name)
Create a new QNetworkCookie object, initializing the cookie name to name and its value to value. |
|
QNetworkCookie(QByteArray name,
QByteArray value)
Create a new QNetworkCookie object, initializing the cookie name to name and its value to value. |
|
QNetworkCookie(QNetworkCookie other)
Creates a new QNetworkCookie object by copying the contents of other. |
Method Summary | |
---|---|
QNetworkCookie |
clone()
This method is reimplemented for internal reasons |
java.lang.String |
domain()
Returns the domain this cookie is associated with. |
QDateTime |
expirationDate()
Returns the expiration date for this cookie. |
boolean |
isSecure()
Returns true if the "secure" option was specified in the cookie string, false otherwise. |
boolean |
isSessionCookie()
Returns true if this cookie is a session cookie. |
QByteArray |
name()
Returns the name of this cookie. |
static java.util.List |
parseCookies(QByteArray cookieString)
Parses the cookie string cookieString as received from a server response in the "Set-Cookie." header. |
java.lang.String |
path()
Returns the path associated with this cookie. |
void |
setDomain(java.lang.String domain)
Sets the domain associated with this cookie to be domain. |
void |
setExpirationDate(QDateTime date)
Sets the expiration date of this cookie to date. |
void |
setName(QByteArray cookieName)
Sets the name of this cookie to be cookieName. |
void |
setPath(java.lang.String path)
Sets the path associated with this cookie to be path. |
void |
setSecure(boolean enable)
Sets the secure flag of this cookie to enable. |
void |
setValue(QByteArray value)
Sets the value of this cookie to be value. |
QByteArray |
toRawForm()
Returns the raw form of this QNetworkCookie . |
QByteArray |
toRawForm(QNetworkCookie.RawForm form)
Returns the raw form of this QNetworkCookie . |
java.lang.String |
toString()
|
QByteArray |
value()
Returns this cookies value, as specified in the cookie string. |
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, wait, wait, wait |
Methods inherited from interface com.trolltech.qt.QtJambiInterface |
---|
disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership |
Constructor Detail |
---|
public QNetworkCookie(QByteArray name)
QNetworkCookie
object, initializing the cookie name to name and its value to value. A cookie is only valid if it has a name. However, the value is opaque to the application and being empty may have significance to the remote server.
public QNetworkCookie()
QNetworkCookie
object, initializing the cookie name to name and its value to value. A cookie is only valid if it has a name. However, the value is opaque to the application and being empty may have significance to the remote server.
public QNetworkCookie(QByteArray name, QByteArray value)
QNetworkCookie
object, initializing the cookie name to name and its value to value. A cookie is only valid if it has a name. However, the value is opaque to the application and being empty may have significance to the remote server.
public QNetworkCookie(QNetworkCookie other)
QNetworkCookie
object by copying the contents of other.
Method Detail |
---|
public final java.lang.String domain()
Note that the domain here may start with a dot, which is not a valid hostname. However, it means this cookie matches all hostnames ending with that domain name.
setDomain()
.
public final QDateTime expirationDate()
QDateTime
returned will not be valid. If the date is in the past, this cookie has already expired and should not be sent again back to a remote server. The expiration date corresponds to the parameters of the "expires" entry in the cookie string.
isSessionCookie()
, and setExpirationDate()
.
public final boolean isSecure()
Secure cookies may contain private information and should not be resent over unencrypted connections.
setSecure()
.
public final boolean isSessionCookie()
expirationDate()
, and setExpirationDate()
.
public final QByteArray name()
setName()
, and value()
.
public final java.lang.String path()
setPath()
.
public final void setDomain(java.lang.String domain)
domain()
.
public final void setExpirationDate(QDateTime date)
isSessionCookie()
, and expirationDate()
.
public final void setName(QByteArray cookieName)
QByteArray
will make this cookie invalid. name()
, and value()
.
public final void setPath(java.lang.String path)
path()
.
public final void setSecure(boolean enable)
Secure cookies may contain private information and should not be resent over unencrypted connections.
isSecure()
.
public final void setValue(QByteArray value)
value()
, and name()
.
public final QByteArray toRawForm()
QNetworkCookie
. The QByteArray
returned by this function is suitable for an HTTP header, either in a server response (the Set-Cookie header) or the client request (the Cookie header). You can choose from one of two formats, using form. parseCookies()
.
public final QByteArray toRawForm(QNetworkCookie.RawForm form)
QNetworkCookie
. The QByteArray
returned by this function is suitable for an HTTP header, either in a server response (the Set-Cookie header) or the client request (the Cookie header). You can choose from one of two formats, using form. parseCookies()
.
public final QByteArray value()
Cookie name-value pairs are considered opaque to the application: that is, their values don't mean anything.
setValue()
, and name()
.
public static java.util.List parseCookies(QByteArray cookieString)
Since the HTTP header can set more than one cookie at the same time, this function returns a QList<QNetworkCookie
>, one for each cookie that is parsed.
toRawForm()
.
public java.lang.String toString()
toString
in class java.lang.Object
public QNetworkCookie clone()
clone
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |