|
|||||||||
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.QNetworkProxyQuery
public class QNetworkProxyQuery
The QNetworkProxyQuery class is used to query the proxy settings for a socket QNetworkProxyQuery holds the details of a socket being created or request being made. It is used by QNetworkProxy
and QNetworkProxyFactory
to allow applications to have a more fine-grained control over which proxy servers are used, depending on the details of the query. This allows an application to apply different settings, according to the protocol or destination hostname, for instance.
QNetworkProxyQuery supports the following criteria for selecting the proxy:
QTcpSocket::connectToHost()
or the host component of a URL requested with QNetworkRequest
. The destination port number is the requested port to connect to in the case of outgoing sockets, while the local port number is the port the socket wishes to use locally before attempting the external connection. In most cases, the local port number is used by listening sockets only (QTcpSocket
) or by datagram sockets (QUdpSocket
).
The protocol name is an arbitrary string that indicates the type of connection being attempted. For example, it can match the scheme of a URL, like "http", "https" and "ftp". In most cases, the proxy selection will not change depending on the protocol, but this information is provided in case a better choice can be made, like choosing an caching HTTP proxy for HTTP-based connections, but a more powerful SOCKSv5 proxy for all others.
Some of the criteria may not make sense in all of the types of query. The following table lists the criteria that are most commonly used, according to the type of query.
TcpSocket | Normal sockets requesting a connection to a remote server, like QTcpSocket . The peer hostname and peer port match the values passed to QTcpSocket::connectToHost() . The local port is usually -1, indicating the socket has no preference in which port should be used. The URL component is not used. |
UdpSocket | Datagram-based sockets, which can both send and receive. The local port, remote host or remote port fields can all be used or be left unused, depending on the characteristics of the socket. The URL component is not used. |
TcpServer | Passive server sockets that listen on a port and await incoming connections from the network. Normally, only the local port is used, but the remote address could be used in specific circumstances, for example to indicate which remote host a connection is expected from. The URL component is not used. |
UrlRequest | A more high-level request, such as those coming from QNetworkAccessManager . These requests will inevitably use an outgoing TCP socket, but the this query type is provided to indicate that more detailed information is present in the URL component. For ease of implementation, the URL's host and port are set as the destination address. |
QNetworkProxy
, QNetworkProxyFactory
, QNetworkAccessManager
, and QAbstractSocket::setProxy()
.
Nested Class Summary | |
---|---|
static class |
QNetworkProxyQuery.QueryType
Describes the type of one QNetworkProxyQuery query. |
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 | |
---|---|
QNetworkProxyQuery()
Constructs a default QNetworkProxyQuery object. |
|
QNetworkProxyQuery(char bindPort)
This is an overloaded method provided for convenience. |
|
QNetworkProxyQuery(char bindPort,
java.lang.String protocolTag)
This is an overloaded method provided for convenience. |
|
QNetworkProxyQuery(char bindPort,
java.lang.String protocolTag,
QNetworkProxyQuery.QueryType queryType)
This is an overloaded method provided for convenience. |
|
QNetworkProxyQuery(QNetworkProxyQuery other)
Constructs a QNetworkProxyQuery object that is a copy of other. |
|
QNetworkProxyQuery(QUrl requestUrl)
Constructs a QNetworkProxyQuery with the URL requestUrl and sets the query type to queryType. |
|
QNetworkProxyQuery(QUrl requestUrl,
QNetworkProxyQuery.QueryType queryType)
Constructs a QNetworkProxyQuery with the URL requestUrl and sets the query type to queryType. |
|
QNetworkProxyQuery(java.lang.String hostname,
int port)
Constructs a QNetworkProxyQuery of type queryType and sets the protocol tag to be protocolTag. |
|
QNetworkProxyQuery(java.lang.String hostname,
int port,
java.lang.String protocolTag)
Constructs a QNetworkProxyQuery of type queryType and sets the protocol tag to be protocolTag. |
|
QNetworkProxyQuery(java.lang.String hostname,
int port,
java.lang.String protocolTag,
QNetworkProxyQuery.QueryType queryType)
Constructs a QNetworkProxyQuery of type queryType and sets the protocol tag to be protocolTag. |
Method Summary | |
---|---|
QNetworkProxyQuery |
clone()
This method is reimplemented for internal reasons |
int |
localPort()
Returns the port number of the socket that will accept incoming packets from remote servers or -1 if the port is not known. |
java.lang.String |
peerHostName()
Returns the host name or IP address being of the outgoing connection being requested, or an empty string if the remote hostname is not known. |
int |
peerPort()
Returns the port number for the outgoing request or -1 if the port number is not known. |
java.lang.String |
protocolTag()
Returns the protocol tag for this QNetworkProxyQuery object, or an empty QString in case the protocol tag is unknown. |
QNetworkProxyQuery.QueryType |
queryType()
Returns the query type. |
void |
setLocalPort(int port)
Sets the port number that the socket wishes to use locally to accept incoming packets from remote servers to port. |
void |
setPeerHostName(java.lang.String hostname)
Sets the hostname of the outgoing connection being requested to hostname. |
void |
setPeerPort(int port)
Sets the requested port number for the outgoing connection to be port. |
void |
setProtocolTag(java.lang.String protocolTag)
Sets the protocol tag for this QNetworkProxyQuery object to be protocolTag. |
void |
setQueryType(QNetworkProxyQuery.QueryType type)
Sets the query type of this object to be type. |
void |
setUrl(QUrl url)
Sets the URL component of this QNetworkProxyQuery object to be url. |
QUrl |
url()
Returns the URL component of this QNetworkProxyQuery object in case of a query of type QNetworkProxyQuery::UrlRequest . |
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 |
---|
public QNetworkProxyQuery()
QNetworkProxyQuery::TcpSocket
.
public QNetworkProxyQuery(QNetworkProxyQuery other)
public QNetworkProxyQuery(java.lang.String hostname, int port, java.lang.String protocolTag)
QNetworkProxyQuery::TcpSocket
queries, because it sets the peer hostname to hostname and the peer's port number to port.
public QNetworkProxyQuery(java.lang.String hostname, int port)
QNetworkProxyQuery::TcpSocket
queries, because it sets the peer hostname to hostname and the peer's port number to port.
public QNetworkProxyQuery(java.lang.String hostname, int port, java.lang.String protocolTag, QNetworkProxyQuery.QueryType queryType)
QNetworkProxyQuery::TcpSocket
queries, because it sets the peer hostname to hostname and the peer's port number to port.
public QNetworkProxyQuery(QUrl requestUrl)
protocolTag()
, peerHostName()
, and peerPort()
.
public QNetworkProxyQuery(QUrl requestUrl, QNetworkProxyQuery.QueryType queryType)
protocolTag()
, peerHostName()
, and peerPort()
.
public QNetworkProxyQuery(char bindPort, java.lang.String protocolTag)
public QNetworkProxyQuery(char bindPort)
public QNetworkProxyQuery(char bindPort, java.lang.String protocolTag, QNetworkProxyQuery.QueryType queryType)
Method Detail |
---|
public final int localPort()
peerPort()
, peerHostName()
, and setLocalPort()
.
public final java.lang.String peerHostName()
If the query type is QNetworkProxyQuery::UrlRequest
, this function returns the host component of the URL being requested.
peerPort()
, localPort()
, and setPeerHostName()
.
public final int peerPort()
If the query type is QNetworkProxyQuery::UrlRequest
, this function returns the port number of the URL being requested. In general, frameworks will fill in the port number from their default values.
peerHostName()
, localPort()
, and setPeerPort()
.
public final java.lang.String protocolTag()
In the case of queries of type QNetworkProxyQuery::UrlRequest
, this function returns the value of the scheme component of the URL.
setProtocolTag()
, and url()
.
public final QNetworkProxyQuery.QueryType queryType()
setQueryType()
.
public final void setLocalPort(int port)
QNetworkProxyQuery::TcpServer
and QNetworkProxyQuery::UdpSocket
query types. Valid values are 0 to 65535 (with 0 indicating that any port number will be acceptable) or -1, which means the local port number is unknown or not applicable.
In some circumstances, for special protocols, it's the local port number can also be used with a query of type QNetworkProxyQuery::TcpSocket
. When that happens, the socket is indicating it wishes to use the port number port when connecting to a remote host.
localPort()
, setPeerPort()
, and setPeerHostName()
.
public final void setPeerHostName(java.lang.String hostname)
The peer host name can also be used to indicate the expected source address of an incoming connection in the case of QNetworkProxyQuery::UdpSocket
or QNetworkProxyQuery::TcpServer
query types.
peerHostName()
, setPeerPort()
, and setLocalPort()
.
public final void setPeerPort(int port)
The peer port number can also be used to indicate the expected port number of an incoming connection in the case of QNetworkProxyQuery::UdpSocket
or QNetworkProxyQuery::TcpServer
query types.
peerPort()
, setPeerHostName()
, and setLocalPort()
.
public final void setProtocolTag(java.lang.String protocolTag)
The protocol tag is an arbitrary string that indicates which protocol is being talked over the socket, such as "http", "xmpp", "telnet", etc. The protocol tag is used by the backend to return a request that is more specific to the protocol in question: for example, a HTTP connection could be use a caching HTTP proxy server, while all other connections use a more powerful SOCKSv5 proxy server.
protocolTag()
.
public final void setQueryType(QNetworkProxyQuery.QueryType type)
queryType()
.
public final void setUrl(QUrl url)
url()
, peerHostName()
, and peerPort()
.
public final QUrl url()
QNetworkProxyQuery::UrlRequest
. setUrl()
.
public QNetworkProxyQuery clone()
clone
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |