Class NSMutableURLRequest

  • All Implemented Interfaces:
    NSCoding, NSCopying, NSMutableCopying, NSSecureCoding, NSObject

    public class NSMutableURLRequest
    extends NSURLRequest
    NSMutableURLRequest An NSMutableURLRequest object represents a mutable URL load request in a manner independent of protocol and URL scheme. This specialization of NSURLRequest is provided to aid developers who may find it more convenient to mutate a single request object for a series of URL loads instead of creating an immutable NSURLRequest for each load. This programming model is supported by the following contract stipulation between NSMutableURLRequest and NSURLConnection: NSURLConnection makes a deep copy of each NSMutableURLRequest object passed to one of its initializers.

    NSMutableURLRequest is designed to be extended to support protocol-specific data by adding categories to access a property object provided in an interface targeted at protocol implementors.

    • Protocol implementors should direct their attention to the NSMutableURLRequestExtensibility category on NSMutableURLRequest for more information on how to provide extensions on NSMutableURLRequest to support protocol-specific request information.
    • Clients of this API who wish to create NSMutableURLRequest objects to load URL content should consult the protocol-specific NSMutableURLRequest categories that are available. The NSMutableHTTPURLRequest category on NSMutableURLRequest is an example.
    • Constructor Detail

      • NSMutableURLRequest

        protected NSMutableURLRequest​(org.moe.natj.general.Pointer peer)
    • Method Detail

      • accessInstanceVariablesDirectly

        public static boolean accessInstanceVariablesDirectly()
      • allocWithZone

        public static java.lang.Object allocWithZone​(org.moe.natj.general.ptr.VoidPtr zone)
      • automaticallyNotifiesObserversForKey

        public static boolean automaticallyNotifiesObserversForKey​(java.lang.String key)
      • cancelPreviousPerformRequestsWithTarget

        public static void cancelPreviousPerformRequestsWithTarget​(java.lang.Object aTarget)
      • cancelPreviousPerformRequestsWithTargetSelectorObject

        public static void cancelPreviousPerformRequestsWithTargetSelectorObject​(java.lang.Object aTarget,
                                                                                 org.moe.natj.objc.SEL aSelector,
                                                                                 java.lang.Object anArgument)
      • classFallbacksForKeyedArchiver

        public static NSArray<java.lang.String> classFallbacksForKeyedArchiver()
      • classForKeyedUnarchiver

        public static org.moe.natj.objc.Class classForKeyedUnarchiver()
      • debugDescription_static

        public static java.lang.String debugDescription_static()
      • description_static

        public static java.lang.String description_static()
      • hash_static

        public static long hash_static()
      • instanceMethodSignatureForSelector

        public static NSMethodSignature instanceMethodSignatureForSelector​(org.moe.natj.objc.SEL aSelector)
      • instancesRespondToSelector

        public static boolean instancesRespondToSelector​(org.moe.natj.objc.SEL aSelector)
      • isSubclassOfClass

        public static boolean isSubclassOfClass​(org.moe.natj.objc.Class aClass)
      • keyPathsForValuesAffectingValueForKey

        public static NSSet<java.lang.String> keyPathsForValuesAffectingValueForKey​(java.lang.String key)
      • new_objc

        public static java.lang.Object new_objc()
      • requestWithURLCachePolicyTimeoutInterval

        public static NSMutableURLRequest requestWithURLCachePolicyTimeoutInterval​(NSURL URL,
                                                                                   long cachePolicy,
                                                                                   double timeoutInterval)
      • resolveClassMethod

        public static boolean resolveClassMethod​(org.moe.natj.objc.SEL sel)
      • resolveInstanceMethod

        public static boolean resolveInstanceMethod​(org.moe.natj.objc.SEL sel)
      • setVersion_static

        public static void setVersion_static​(long aVersion)
      • superclass_static

        public static org.moe.natj.objc.Class superclass_static()
      • supportsSecureCoding

        public static boolean supportsSecureCoding()
      • version_static

        public static long version_static()
      • HTTPBody

        public NSData HTTPBody()
        Sets the request body data of the receiver. This data is sent as the message body of the request, as in done in an HTTP POST request.
        Overrides:
        HTTPBody in class NSURLRequest
        Returns:
        The request body data of the receiver.
      • HTTPBodyStream

        public NSInputStream HTTPBodyStream()
        Sets the request body to be the contents of the given stream. The provided stream should be unopened; the request will take over the stream's delegate. The entire stream's contents will be transmitted as the HTTP body of the request. Note that the body stream and the body data (set by setHTTPBody:, above) are mutually exclusive - setting one will clear the other.
        Overrides:
        HTTPBodyStream in class NSURLRequest
        Returns:
        The request body stream of the receiver.
      • HTTPMethod

        public java.lang.String HTTPMethod()
        Sets the HTTP request method of the receiver.
        Overrides:
        HTTPMethod in class NSURLRequest
        Returns:
        the HTTP request method of the receiver.
      • HTTPShouldHandleCookies

        public boolean HTTPShouldHandleCookies()
        Decide whether default cookie handling will happen for this request (YES if cookies should be sent with and set for this request; otherwise NO). The default is YES - in other words, cookies are sent from and stored to the cookie manager by default. NOTE: In releases prior to 10.3, this value is ignored
        Overrides:
        HTTPShouldHandleCookies in class NSURLRequest
        Returns:
        YES if cookies will be sent with and set for this request; otherwise NO.
      • HTTPShouldUsePipelining

        public boolean HTTPShouldUsePipelining()
        Sets whether the request should not wait for the previous response before transmitting (YES if the receiver should transmit before the previous response is received. NO to wait for the previous response before transmitting) Calling this method with a YES value does not guarantee HTTP pipelining behavior. This method may have no effect if an HTTP proxy is configured, or if the HTTP request uses an unsafe request method (e.g., POST requests will not pipeline). Pipelining behavior also may not begin until the second request on a given TCP connection. There may be other situations where pipelining does not occur even though YES was set. HTTP 1.1 allows the client to send multiple requests to the server without waiting for a response. Though HTTP 1.1 requires support for pipelining, some servers report themselves as being HTTP 1.1 but do not support pipelining (disconnecting, sending resources misordered, omitting part of a resource, etc.).
        Overrides:
        HTTPShouldUsePipelining in class NSURLRequest
        Returns:
        YES if the receiver should transmit before the previous response is received. NO if the receiver should wait for the previous response before transmitting.
      • URL

        public NSURL URL()
        The URL of the receiver.
        Overrides:
        URL in class NSURLRequest
        Returns:
        The URL of the receiver.
      • addValueForHTTPHeaderField

        public void addValueForHTTPHeaderField​(java.lang.String value,
                                               java.lang.String field)
        addValue:forHTTPHeaderField: Adds an HTTP header field in the current header dictionary. This method provides a way to add values to header fields incrementally. If a value was previously set for the given header field, the given value is appended to the previously-existing value. The appropriate field delimiter, a comma in the case of HTTP, is added by the implementation, and should not be added to the given value by the caller. Note that, in keeping with the HTTP RFC, HTTP header field names are case-insensitive.
        Parameters:
        value - the header field value.
        field - the header field name (case-insensitive).
      • allHTTPHeaderFields

        public NSDictionary<java.lang.String,​java.lang.String> allHTTPHeaderFields()
        Sets the HTTP header fields of the receiver to the given dictionary. This method replaces all header fields that may have existed before this method call.

        Since HTTP header fields must be string values, each object and key in the dictionary passed to this method must answer YES when sent an -isKindOfClass:[NSString class] message. If either the key or value for a key-value pair answers NO when sent this message, the key-value pair is skipped.

        Overrides:
        allHTTPHeaderFields in class NSURLRequest
        Returns:
        a dictionary containing all the HTTP header fields of the receiver.
      • allowsCellularAccess

        public boolean allowsCellularAccess()
        sets whether a connection created with this request is allowed to use the built in cellular radios (if present). NO if the receiver should not be allowed to use the built in cellular radios to satisfy the request, YES otherwise. The default is YES.
        Overrides:
        allowsCellularAccess in class NSURLRequest
        Returns:
        YES if the receiver is allowed to use the built in cellular radios to satify the request, NO otherwise.
      • bindToHotspotHelperCommand

        public void bindToHotspotHelperCommand​(NEHotspotHelperCommand command)
        bindToHotspotHelperCommand: Binds the NSMutableURLRequest to the network interface associated with the NEHotspotHelperCommand object.
      • cachePolicy

        public long cachePolicy()
        The cache policy of the receiver.
        Overrides:
        cachePolicy in class NSURLRequest
        Returns:
        The cache policy of the receiver.
      • initWithURL

        public NSMutableURLRequest initWithURL​(NSURL URL)
        Description copied from class: NSURLRequest
        initWithURL: Initializes an NSURLRequest with the given URL. Default values are used for cache policy (NSURLRequestUseProtocolCachePolicy) and timeout interval (60 seconds).
        Overrides:
        initWithURL in class NSURLRequest
        Parameters:
        URL - The URL for the request.
        Returns:
        An initialized NSURLRequest.
      • initWithURLCachePolicyTimeoutInterval

        public NSMutableURLRequest initWithURLCachePolicyTimeoutInterval​(NSURL URL,
                                                                         long cachePolicy,
                                                                         double timeoutInterval)
        Description copied from class: NSURLRequest
        initWithURL: Initializes an NSURLRequest with the given URL and cache policy. This is the designated initializer for the NSURLRequest class.
        Overrides:
        initWithURLCachePolicyTimeoutInterval in class NSURLRequest
        Parameters:
        URL - The URL for the request.
        cachePolicy - The cache policy for the request.
        timeoutInterval - The timeout interval for the request. See the commentary for the timeoutInterval for more information on timeout intervals.
        Returns:
        An initialized NSURLRequest.
      • mainDocumentURL

        public NSURL mainDocumentURL()
        Sets the main document URL The caller should pass the URL for an appropriate main document, if known. For example, when loading a web page, the URL of the main html document for the top-level frame should be passed. This main document will be used to implement the cookie "only from same domain as main document" policy, and possibly other things in the future. NOTE: In the current implementation, the passed-in value is unused by the framework. A fully functional version of this method will be available in the future.
        Overrides:
        mainDocumentURL in class NSURLRequest
        Returns:
        The main document URL.
      • networkServiceType

        public long networkServiceType()
        Sets the NSURLRequestNetworkServiceType to associate with this request This method is used to provide the network layers with a hint as to the purpose of the request. Most clients should not need to use this method.
        Overrides:
        networkServiceType in class NSURLRequest
        Returns:
        The NSURLRequestNetworkServiceType associated with this request.
      • setAllHTTPHeaderFields

        public void setAllHTTPHeaderFields​(NSDictionary<java.lang.String,​java.lang.String> value)
        Sets the HTTP header fields of the receiver to the given dictionary. This method replaces all header fields that may have existed before this method call.

        Since HTTP header fields must be string values, each object and key in the dictionary passed to this method must answer YES when sent an -isKindOfClass:[NSString class] message. If either the key or value for a key-value pair answers NO when sent this message, the key-value pair is skipped.

      • setAllowsCellularAccess

        public void setAllowsCellularAccess​(boolean value)
        sets whether a connection created with this request is allowed to use the built in cellular radios (if present). NO if the receiver should not be allowed to use the built in cellular radios to satisfy the request, YES otherwise. The default is YES.
      • setCachePolicy

        public void setCachePolicy​(long value)
        The cache policy of the receiver.
      • setHTTPBody

        public void setHTTPBody​(NSData value)
        Sets the request body data of the receiver. This data is sent as the message body of the request, as in done in an HTTP POST request.
      • setHTTPBodyStream

        public void setHTTPBodyStream​(NSInputStream value)
        Sets the request body to be the contents of the given stream. The provided stream should be unopened; the request will take over the stream's delegate. The entire stream's contents will be transmitted as the HTTP body of the request. Note that the body stream and the body data (set by setHTTPBody:, above) are mutually exclusive - setting one will clear the other.
      • setHTTPMethod

        public void setHTTPMethod​(java.lang.String value)
        Sets the HTTP request method of the receiver.
      • setHTTPShouldHandleCookies

        public void setHTTPShouldHandleCookies​(boolean value)
        Decide whether default cookie handling will happen for this request (YES if cookies should be sent with and set for this request; otherwise NO). The default is YES - in other words, cookies are sent from and stored to the cookie manager by default. NOTE: In releases prior to 10.3, this value is ignored
      • setHTTPShouldUsePipelining

        public void setHTTPShouldUsePipelining​(boolean value)
        Sets whether the request should not wait for the previous response before transmitting (YES if the receiver should transmit before the previous response is received. NO to wait for the previous response before transmitting) Calling this method with a YES value does not guarantee HTTP pipelining behavior. This method may have no effect if an HTTP proxy is configured, or if the HTTP request uses an unsafe request method (e.g., POST requests will not pipeline). Pipelining behavior also may not begin until the second request on a given TCP connection. There may be other situations where pipelining does not occur even though YES was set. HTTP 1.1 allows the client to send multiple requests to the server without waiting for a response. Though HTTP 1.1 requires support for pipelining, some servers report themselves as being HTTP 1.1 but do not support pipelining (disconnecting, sending resources misordered, omitting part of a resource, etc.).
      • setMainDocumentURL

        public void setMainDocumentURL​(NSURL value)
        Sets the main document URL The caller should pass the URL for an appropriate main document, if known. For example, when loading a web page, the URL of the main html document for the top-level frame should be passed. This main document will be used to implement the cookie "only from same domain as main document" policy, and possibly other things in the future. NOTE: In the current implementation, the passed-in value is unused by the framework. A fully functional version of this method will be available in the future.
      • setNetworkServiceType

        public void setNetworkServiceType​(long value)
        Sets the NSURLRequestNetworkServiceType to associate with this request This method is used to provide the network layers with a hint as to the purpose of the request. Most clients should not need to use this method.
      • setTimeoutInterval

        public void setTimeoutInterval​(double value)
        Sets the timeout interval of the receiver. The timeout interval specifies the limit on the idle interval allotted to a request in the process of loading. The "idle interval" is defined as the period of time that has passed since the last instance of load activity occurred for a request that is in the process of loading. Hence, when an instance of load activity occurs (e.g. bytes are received from the network for a request), the idle interval for a request is reset to 0. If the idle interval ever becomes greater than or equal to the timeout interval, the request is considered to have timed out. This timeout interval is measured in seconds.
      • setURL

        public void setURL​(NSURL value)
        The URL of the receiver.
      • setValueForHTTPHeaderField

        public void setValueForHTTPHeaderField​(java.lang.String value,
                                               java.lang.String field)
        setValue:forHTTPHeaderField: Sets the value of the given HTTP header field. If a value was previously set for the given header field, that value is replaced with the given value. Note that, in keeping with the HTTP RFC, HTTP header field names are case-insensitive.
        Parameters:
        value - the header field value.
        field - the header field name (case-insensitive).
      • _supportsSecureCoding

        public boolean _supportsSecureCoding()
        Description copied from interface: NSSecureCoding
        This property must return YES on all classes that allow secure coding. Subclasses of classes that adopt NSSecureCoding and override initWithCoder: must also override this method and return YES. The Secure Coding Guide should be consulted when writing methods that decode data.
        Specified by:
        _supportsSecureCoding in interface NSSecureCoding
        Overrides:
        _supportsSecureCoding in class NSURLRequest
      • timeoutInterval

        public double timeoutInterval()
        Sets the timeout interval of the receiver. The timeout interval specifies the limit on the idle interval allotted to a request in the process of loading. The "idle interval" is defined as the period of time that has passed since the last instance of load activity occurred for a request that is in the process of loading. Hence, when an instance of load activity occurs (e.g. bytes are received from the network for a request), the idle interval for a request is reset to 0. If the idle interval ever becomes greater than or equal to the timeout interval, the request is considered to have timed out. This timeout interval is measured in seconds.
        Overrides:
        timeoutInterval in class NSURLRequest
        Returns:
        The timeout interval of the receiver.
      • allowsConstrainedNetworkAccess

        public boolean allowsConstrainedNetworkAccess()
        sets whether a connection created with this request is allowed to use network interfaces which have been marked as constrained. NO if the receiver should not be allowed to use an interface marked as constrained to satify the request, YES otherwise.
        Overrides:
        allowsConstrainedNetworkAccess in class NSURLRequest
        Returns:
        YES if the receiver is allowed to use an interface marked as constrained to satify the request, NO otherwise.
      • allowsExpensiveNetworkAccess

        public boolean allowsExpensiveNetworkAccess()
        sets whether a connection created with this request is allowed to use network interfaces which have been marked as expensive. NO if the receiver should not be allowed to use an interface marked as expensive to satify the request, YES otherwise.
        Overrides:
        allowsExpensiveNetworkAccess in class NSURLRequest
        Returns:
        YES if the receiver is allowed to use an interface marked as expensive to satify the request, NO otherwise.
      • setAllowsConstrainedNetworkAccess

        public void setAllowsConstrainedNetworkAccess​(boolean value)
        sets whether a connection created with this request is allowed to use network interfaces which have been marked as constrained. NO if the receiver should not be allowed to use an interface marked as constrained to satify the request, YES otherwise.
      • setAllowsExpensiveNetworkAccess

        public void setAllowsExpensiveNetworkAccess​(boolean value)
        sets whether a connection created with this request is allowed to use network interfaces which have been marked as expensive. NO if the receiver should not be allowed to use an interface marked as expensive to satify the request, YES otherwise.