RequestConfiguration Class

  • RequestConfiguration
  • class Esri::ArcGISRuntime::RequestConfiguration

    Configuration parameters that apply to network requests. More...

    Header: #include <RequestConfiguration.h>
    Since: Esri::ArcGISRuntime 100.1

    Public Functions

    RequestConfiguration()
    RequestConfiguration(int timeoutInterval, int maxNumberOfAttempts, bool forcePost, bool issueAuthenticationChallenge, const QMap<QString, QString> &userHeaders = QMap<QString, QString>())
    RequestConfiguration(const Esri::ArcGISRuntime::RequestConfiguration &other)
    RequestConfiguration(Esri::ArcGISRuntime::RequestConfiguration &&other)
    ~RequestConfiguration()
    bool isEmpty() const
    bool isForcePost() const
    bool isIssueAuthenticationChallenge() const
    int maxNumberOfAttempts() const
    void setForcePost(bool forcePost)
    void setIssueAuthenticationChallenge(bool issueAuthenticationChallenge)
    void setMaxNumberOfAttempts(int attempts)
    void setTimeoutInterval(int timeoutInterval)
    void setUserHeaders(const QMap<QString, QString> &userHeaders)
    int timeoutInterval() const
    QMap<QString, QString> userHeaders() const
    Esri::ArcGISRuntime::RequestConfiguration &operator=(const Esri::ArcGISRuntime::RequestConfiguration &other)
    Esri::ArcGISRuntime::RequestConfiguration &operator=(Esri::ArcGISRuntime::RequestConfiguration &&other)

    Static Public Members

    QString additionalUserAgentInfo()
    Esri::ArcGISRuntime::NetworkCacheConfiguration *globalNetworkCacheConfiguration()
    Esri::ArcGISRuntime::RequestConfiguration globalRequestConfiguration()
    void setAdditionalUserAgentInfo(const QString &additionalUserAgentInfo)
    void setGlobalRequestConfiguration(const Esri::ArcGISRuntime::RequestConfiguration &globalRequestConfiguration)

    Detailed Description

    There are several API classes that perform one or more network requests as they perform their tasks. Sometimes it is useful to set parameters for these network requests. For example, you may want to set the maximum number of retries or a request timeout. Therefore, classes that inherit the RemoteResource class give you access to these network request parameters. This RequestConfiguration class contains these parameters. It also contains a global RequestConfiguration.

    The global RequestConfiguration is used by objects that implement RemoteResource and have not set object-specific network request parameters. The default values for each parameter are listed on the property getters and setters of this class. You can replace the global default RequestConfiguration using the static method RequestConfiguration::setGlobalRequestConfiguration. For example, you can change the global RequestConfiguration to add a HTML header to all requests without having to set a RequestConfiguration on every object.

    Occasionally, different objects will need different RequestConfigurations. You can set one for any object that implements RemoteResource by using the method RemoteResource::setRequestConfiguration. The object-specific RequestConfiguration is used for any request made through the context of that object, such as all requests made using a specific Portal instance. The object-specific RequestConfiguration overrides the global RequestConfiguration mentioned above.

    To stop using an object-specific RequestConfiguration that you previously set, set it to an empty RequestConfiguration. After this is done, requests made through that object will use the properties in the global RequestConfiguration.

    See also RemoteResource.

    Member Function Documentation

    RequestConfiguration::RequestConfiguration()

    Default constructor.

    RequestConfiguration::RequestConfiguration(int timeoutInterval, int maxNumberOfAttempts, bool forcePost, bool issueAuthenticationChallenge, const QMap<QString, QString> &userHeaders = QMap<QString, QString>())

    Constructor taking timeoutInterval, maxNumberOfAttempts, forcePost, issueAuthenticationChallenge and additional userHeaders (optional).

    RequestConfiguration::RequestConfiguration(const Esri::ArcGISRuntime::RequestConfiguration &other)

    Copy constructor from other RequestConfiguration.

    RequestConfiguration::RequestConfiguration(Esri::ArcGISRuntime::RequestConfiguration &&other)

    Move constructor from other RequestConfiguration.

    RequestConfiguration::~RequestConfiguration()

    Destructor.

    [static] QString RequestConfiguration::additionalUserAgentInfo()

    Returns the additional information that is appended to the User-Agent header field in all HTTP requests.

    This is used in some cases to identify the name and version of the application software.

    The default value is an empty QString.

    See also setAdditionalUserAgentInfo().

    [static] Esri::ArcGISRuntime::NetworkCacheConfiguration *RequestConfiguration::globalNetworkCacheConfiguration()

    Returns the singleton instance of the NetworkCacheConfiguration.

    Use this method to get a reference to this instance so you can connect its signals to slots.

    [static] Esri::ArcGISRuntime::RequestConfiguration RequestConfiguration::globalRequestConfiguration()

    Returns the global RequestConfiguration.

    See also setGlobalRequestConfiguration().

    bool RequestConfiguration::isEmpty() const

    Returns true if this RequestConfiguration is empty.

    bool RequestConfiguration::isForcePost() const

    Returns whether network requests will be forced as a POST request.

    If true, then even requests which normally use GET will be forced to use POST. Otherwise, it will use GET or POST depending on the default behavior of the request.

    Default value is false.

    bool RequestConfiguration::isIssueAuthenticationChallenge() const

    Returns whether an authentication challenge should be issued upon failure to access the requested resource.

    If true, then the challenge handler will be invoked to prompt the user for credentials. Otherwise, secured services will simply fail. A custom challenge handler may be set if desired.

    Default value is true.

    See also AuthenticationChallenge and AuthenticationManager.

    int RequestConfiguration::maxNumberOfAttempts() const

    Returns maximum number of times the request should be attempted before failing completely and emitting an error.

    Default is 5.

    See also setMaxNumberOfAttempts().

    [static] void RequestConfiguration::setAdditionalUserAgentInfo(const QString &additionalUserAgentInfo)

    Sets additionalUserAgentInfo to be put in the User-Agent header field in all HTTP requests.

    See also additionalUserAgentInfo().

    void RequestConfiguration::setForcePost(bool forcePost)

    Sets whether to force POST request (forcePost).

    See also isForcePost().

    [static] void RequestConfiguration::setGlobalRequestConfiguration(const Esri::ArcGISRuntime::RequestConfiguration &globalRequestConfiguration)

    Sets the global RequestConfiguration to globalRequestConfiguration.

    See also globalRequestConfiguration().

    void RequestConfiguration::setIssueAuthenticationChallenge(bool issueAuthenticationChallenge)

    Sets whether to issue an authentication challenge to issueAuthenticationChallenge.

    See also isIssueAuthenticationChallenge().

    void RequestConfiguration::setMaxNumberOfAttempts(int attempts)

    Sets the maximum number of attempts for requests.

    See also maxNumberOfAttempts().

    void RequestConfiguration::setTimeoutInterval(int timeoutInterval)

    Sets the timeout interval for requests to timeoutInterval seconds.

    See also timeoutInterval().

    void RequestConfiguration::setUserHeaders(const QMap<QString, QString> &userHeaders)

    Sets custom user headers to be added to any outgoing HTTP request to userHeaders.

    See also userHeaders().

    int RequestConfiguration::timeoutInterval() const

    Returns the time out interval for requests (in seconds).

    Default is 60 seconds.

    See also setTimeoutInterval().

    QMap<QString, QString> RequestConfiguration::userHeaders() const

    Returns any custom HTTP headers set on the network request using setUserHeaders.

    This should be a QMap<QString, QString> of pairs.

    See also setUserHeaders().

    Esri::ArcGISRuntime::RequestConfiguration &RequestConfiguration::operator=(const Esri::ArcGISRuntime::RequestConfiguration &other)

    Assignment operator from other RequestConfiguration.

    Esri::ArcGISRuntime::RequestConfiguration &RequestConfiguration::operator=(Esri::ArcGISRuntime::RequestConfiguration &&other)

    Move operator from other RequestConfiguration.

    Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.