Skip To Content ArcGIS for Developers Sign In Dashboard

RequestConfiguration Class


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

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

Public Functions

RequestConfiguration(const RequestConfiguration &other)
RequestConfiguration(RequestConfiguration &&other)
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
RequestConfiguration &operator=(const RequestConfiguration &other)
RequestConfiguration &operator=(RequestConfiguration &&other)

Static Public Members

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

Detailed Description

Configuration parameters that apply to network requests.

There are several API classes that perform one or more network requests as they perform their tasks. Sometimes it's 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


Default constructor.

RequestConfiguration::RequestConfiguration(const RequestConfiguration &other)

Copy constructor from other RequestConfiguration.

RequestConfiguration::RequestConfiguration(RequestConfiguration &&other)

Move constructor from other RequestConfiguration.



[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] 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] 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 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().

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

Assignment operator from other RequestConfiguration.

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

Move operator from other RequestConfiguration.

Feedback on this topic?