Class: NSMutableURLRequest

Inherits:
NSURLRequest show all

Overview

NSMutableURLRequest is a subclass of NSURLRequest provided to aid developers who may find it more convenient to mutate a single request object for a series of URL load requests instead of creating an immutable NSURLRequest for each load.

Instance Method Summary (collapse)

Methods inherited from NSURLRequest

#HTTPBody, #HTTPBodyStream, #HTTPMethod, #HTTPShouldHandleCookies, #HTTPShouldUsePipelining, #URL, #allHTTPHeaderFields, #allowsCellularAccess, #cachePolicy, #initWithURL:, #initWithURL:cachePolicy:timeoutInterval:, #mainDocumentURL, #networkServiceType, requestWithURL:, requestWithURL:cachePolicy:timeoutInterval:, #timeoutInterval, #valueForHTTPHeaderField:

Methods inherited from NSObject

#!, #!=, #!~, #, #==, #===, #=~, #Rational, #__callee__, #__method__, #__send__, #__type__, `, alloc, allocWithZone:, #autoContentAccessingProxy, autoload, autoload?, autorelease_pool, #awakeAfterUsingCoder:, binding, block_given?, caller, cancelPreviousPerformRequestsWithTarget:, cancelPreviousPerformRequestsWithTarget:selector:object:, catch, class, classFallbacksForKeyedArchiver, #classForCoder, #classForKeyedArchiver, classForKeyedUnarchiver, #clone, conformsToProtocol:, #copy, copyWithZone:, #dealloc, #define_singleton_method, description, display, #doesNotRecognizeSelector:, #dup, #enum_for, #eql?, #equal?, #extend, fail, #finalize, format, #forwardInvocation:, #forwardingTargetForSelector:, framework, #freeze, #frozen?, getpass, gets, global_variables, #init, initialize, #initialize_clone, #initialize_copy, #initialize_dup, #inspect, instanceMethodForSelector:, instanceMethodSignatureForSelector:, #instance_eval, #instance_exec, #instance_of?, #instance_variable_defined?, #instance_variable_get, #instance_variable_set, #instance_variables, instancesRespondToSelector:, isSubclassOfClass:, #is_a?, iterator?, #kind_of?, lambda, load, load_bridge_support_file, load_plist, local_variables, loop, #method, #methodForSelector:, #methodSignatureForSelector:, #methods, #mutableCopy, mutableCopyWithZone:, new, #nil?, open, p, #performSelector:onThread:withObject:waitUntilDone:, #performSelector:onThread:withObject:waitUntilDone:modes:, #performSelector:withObject:afterDelay:, #performSelector:withObject:afterDelay:inModes:, #performSelectorInBackground:withObject:, #performSelectorOnMainThread:withObject:waitUntilDone:, #performSelectorOnMainThread:withObject:waitUntilDone:modes:, print, printf, #private_methods, proc, #protected_methods, #public_method, #public_methods, #public_send, putc, puts, raise, rand, readline, readlines, #replacementObjectForCoder:, #replacementObjectForKeyedArchiver:, require, resolveClassMethod:, resolveInstanceMethod:, #respond_to?, #respond_to_missing?, select, #send, setVersion:, #singleton_methods, sprintf, srand, superclass, #taint, #tainted?, #tap, test, throw, #to_plist, #to_s, trace_var, trap, #trust, #untaint, untrace_var, #untrust, #untrusted?, version

Constructor Details

This class inherits a constructor from NSObject

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class NSObject

Instance Method Details

- (Object) addValue(value, forHTTPHeaderField:field)

Adds an HTTP header to the receiver’s HTTP header dictionary. This method provides the ability to add values to header fields incrementally. If a value was previously set for the specified field, the supplied value is appended to the existing value using the appropriate field delimiter. In the case of HTTP, this is a comma.

Parameters:

  • value (String)

    The value for the header field.

  • field (String)

    The name of the header field. In keeping with the HTTP RFC, HTTP header field names are case-insensitive

Returns:

- (Object) setAllHTTPHeaderFields(headerFields)

Replaces the receiver's header fields with the passed values.

Parameters:

  • headerFields (Hash)

    A dictionary with the new header fields. HTTP header fields must be string values; therefore, each object and key in the headerFields dictionary must be a subclass of NSString. If either the key or value for a key-value pair is not a subclass of NSString, the key-value pair is skipped.

Returns:

- (Object) setAllowsCellularAccess(allow)

Sets whether the connection can use the device’s cellular radio (if present). The default is YES.

Parameters:

  • allow (Boolean)

    YES if the device’s cellular radio can be used; NO otherwise;

Returns:

- (Object) setCachePolicy(policy)

Sets the cache policy of the receiver.

Parameters:

  • policy (NSURLRequestCachePolicy)

    The new cache policy.

Returns:

- (Object) setHTTPBody(data)

Sets the request body of the receiver to the specified data. Setting the HTTP body data clears any input stream set by setHTTPBodyStream:. These values are mutually exclusive.

Parameters:

  • data (NSData)

    The new request body for the receiver. This is sent as the message body of the request, as in an HTTP POST request.

Returns:

- (Object) setHTTPBodyStream(inputStream)

Sets the request body of the receiver to the contents of a specified input stream. Setting a body stream clears any data set by setHTTPBody:. These values are mutually exclusive.

Parameters:

  • inputStream (NSInputStream)

    The input stream that will be the request body of the receiver. The entire contents of the stream will be sent as the body, as in an HTTP POST request. The inputStream should be unopened and the receiver will take over as the stream’s delegate.

Returns:

- (Object) setHTTPMethod(method)

Sets the receiver’s HTTP request method.

Parameters:

  • method (String)

    The new HTTP request method. The default HTTP method is “GET”.

Returns:

- (Object) setHTTPShouldHandleCookies(handleCookies)

Sets whether the receiver should use the default cookie handling for the request.

Parameters:

  • handleCookies (Boolean)

    YES if the receiver should use the default cookie handling for the request, NO otherwise. The default is YES.

Returns:

- (Object) setHTTPShouldUsePipelining(shouldUsePipelining)

Sets whether the request can continue transmitting data before receiving a response from an earlier transmission. Specifying YES does not guarantee HTTP pipelining behavior, because some servers do not support pipelining.

Parameters:

  • shouldUsePipelining (Boolean)

    If YES, the request should continue transmitting data; if NO, the request should wait for a response.

Returns:

- (Object) setMainDocumentURL(theURL)

Sets the main document URL for the receiver. The caller should set the main document URL to an appropriate main document, if known. For example, when loading a web page the URL of the HTML document for the top-level frame would be appropriate. This URL will be used for the “only from same domain as main document” cookie accept policy.

Parameters:

  • theURL (NSURL)

    The new main document URL. Can be nil.

Returns:

- (Object) setNetworkServiceType(networkServiceType)

Sets the network service type of the connection.

Parameters:

  • networkServiceType (NSURLRequestNetworkServiceType)

    The network service type.

Returns:

- (Object) setTimeoutInterval(timeoutInterval)

Sets the receiver’s timeout interval, in seconds.

Parameters:

  • timeoutInterval (NSTimeInterval)

    The timeout interval, in seconds. If during a connection attempt the request remains idle for longer than the timeout interval, the request is considered to have timed out. The default timeout interval is 60 seconds.

Returns:

- (Object) setURL(theURL)

Sets the URL of the receiver

Parameters:

  • theURL (NSURL)

    The new URL.

Returns:

- (Object) setValue(value, forHTTPHeaderField:field)

Sets the specified HTTP header field.

Parameters:

  • value (String)

    The new value for the header field. Any existing value for the field is replaced by the new value.

  • field (String)

    The name of the header field to set. In keeping with the HTTP RFC, HTTP header field names are case-insensitive.

Returns: