Class NSURLSessionConfiguration

  • All Implemented Interfaces:
    NSCopying, NSObject

    public class NSURLSessionConfiguration
    extends NSObject
    implements NSCopying
    Configuration options for an NSURLSession. When a session is created, a copy of the configuration object is made - you cannot modify the configuration of a session after it has been created. The shared session uses the global singleton credential, cache and cookie storage objects. An ephemeral session has no persistent disk storage for cookies, cache or credentials. A background session can be used to perform networking operations on behalf of a suspended application, within certain constraints.
    • Constructor Detail

      • NSURLSessionConfiguration

        protected NSURLSessionConfiguration​(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)
      • backgroundSessionConfiguration

        @Deprecated
        public static NSURLSessionConfiguration backgroundSessionConfiguration​(java.lang.String identifier)
        Deprecated.
      • backgroundSessionConfigurationWithIdentifier

        public static NSURLSessionConfiguration backgroundSessionConfigurationWithIdentifier​(java.lang.String identifier)
      • 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()
      • 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()
      • version_static

        public static long version_static()
      • HTTPAdditionalHeaders

        public NSDictionary<?,​?> HTTPAdditionalHeaders()
        Specifies additional headers which will be set on outgoing requests. Note that these headers are added to the request only if not already present.
      • HTTPCookieAcceptPolicy

        public long HTTPCookieAcceptPolicy()
        Policy for accepting cookies. This overrides the policy otherwise specified by the cookie storage.
      • HTTPCookieStorage

        public NSHTTPCookieStorage HTTPCookieStorage()
        The cookie storage object to use, or nil to indicate that no cookies should be handled
      • HTTPMaximumConnectionsPerHost

        public long HTTPMaximumConnectionsPerHost()
        The maximum number of simultanous persistent connections per host
      • HTTPShouldSetCookies

        public boolean HTTPShouldSetCookies()
        Allow the session to set cookies on requests
      • HTTPShouldUsePipelining

        public boolean HTTPShouldUsePipelining()
        Allow the use of HTTP pipelining
      • TLSMaximumSupportedProtocol

        public int TLSMaximumSupportedProtocol()
        The maximum allowable versions of the TLS protocol, from
      • TLSMinimumSupportedProtocol

        public int TLSMinimumSupportedProtocol()
        The minimum allowable versions of the TLS protocol, from
      • URLCache

        public NSURLCache URLCache()
        The URL resource cache, or nil to indicate that no caching is to be performed
      • URLCredentialStorage

        public NSURLCredentialStorage URLCredentialStorage()
        The credential storage object, or nil to indicate that no credential storage is to be used
      • allowsCellularAccess

        public boolean allowsCellularAccess()
        allow request to route over cellular.
      • connectionProxyDictionary

        public NSDictionary<?,​?> connectionProxyDictionary()
        The proxy dictionary, as described by
      • copyWithZone

        public java.lang.Object copyWithZone​(org.moe.natj.general.ptr.VoidPtr zone)
        Specified by:
        copyWithZone in interface NSCopying
      • identifier

        public java.lang.String identifier()
        identifier for the background session configuration
      • isDiscretionary

        public boolean isDiscretionary()
        allows background tasks to be scheduled at the discretion of the system for optimal performance.
      • setDiscretionary

        public void setDiscretionary​(boolean value)
        allows background tasks to be scheduled at the discretion of the system for optimal performance.
      • networkServiceType

        public long networkServiceType()
        type of service for requests.
      • protocolClasses

        public NSArray<? extends org.moe.natj.objc.Class> protocolClasses()
        An optional array of Class objects which subclass NSURLProtocol. The Class will be sent +canInitWithRequest: when determining if an instance of the class can be used for a given URL scheme. You should not use +[NSURLProtocol registerClass:], as that method will register your class with the default session rather than with an instance of NSURLSession. Custom NSURLProtocol subclasses are not available to background sessions.
      • requestCachePolicy

        public long requestCachePolicy()
        default cache policy for requests
      • sessionSendsLaunchEvents

        public boolean sessionSendsLaunchEvents()
        Allows the app to be resumed or launched in the background when tasks in background sessions complete or when auth is required. This only applies to configurations created with +backgroundSessionConfigurationWithIdentifier: and the default value is YES. NOTE: macOS apps based on AppKit do not support background launch.
      • setAllowsCellularAccess

        public void setAllowsCellularAccess​(boolean value)
        allow request to route over cellular.
      • setConnectionProxyDictionary

        public void setConnectionProxyDictionary​(NSDictionary<?,​?> value)
        The proxy dictionary, as described by
      • setHTTPAdditionalHeaders

        public void setHTTPAdditionalHeaders​(NSDictionary<?,​?> value)
        Specifies additional headers which will be set on outgoing requests. Note that these headers are added to the request only if not already present.
      • setHTTPCookieAcceptPolicy

        public void setHTTPCookieAcceptPolicy​(long value)
        Policy for accepting cookies. This overrides the policy otherwise specified by the cookie storage.
      • setHTTPCookieStorage

        public void setHTTPCookieStorage​(NSHTTPCookieStorage value)
        The cookie storage object to use, or nil to indicate that no cookies should be handled
      • setHTTPMaximumConnectionsPerHost

        public void setHTTPMaximumConnectionsPerHost​(long value)
        The maximum number of simultanous persistent connections per host
      • setHTTPShouldSetCookies

        public void setHTTPShouldSetCookies​(boolean value)
        Allow the session to set cookies on requests
      • setHTTPShouldUsePipelining

        public void setHTTPShouldUsePipelining​(boolean value)
        Allow the use of HTTP pipelining
      • setNetworkServiceType

        public void setNetworkServiceType​(long value)
        type of service for requests.
      • setProtocolClasses

        public void setProtocolClasses​(NSArray<? extends org.moe.natj.objc.Class> value)
        An optional array of Class objects which subclass NSURLProtocol. The Class will be sent +canInitWithRequest: when determining if an instance of the class can be used for a given URL scheme. You should not use +[NSURLProtocol registerClass:], as that method will register your class with the default session rather than with an instance of NSURLSession. Custom NSURLProtocol subclasses are not available to background sessions.
      • setRequestCachePolicy

        public void setRequestCachePolicy​(long value)
        default cache policy for requests
      • setSessionSendsLaunchEvents

        public void setSessionSendsLaunchEvents​(boolean value)
        Allows the app to be resumed or launched in the background when tasks in background sessions complete or when auth is required. This only applies to configurations created with +backgroundSessionConfigurationWithIdentifier: and the default value is YES. NOTE: macOS apps based on AppKit do not support background launch.
      • setSharedContainerIdentifier

        public void setSharedContainerIdentifier​(java.lang.String value)
        The identifier of the shared data container into which files in background sessions should be downloaded. App extensions wishing to use background sessions *must* set this property to a valid container identifier, or all transfers in that session will fail with NSURLErrorBackgroundSessionRequiresSharedContainer.
      • setShouldUseExtendedBackgroundIdleMode

        public void setShouldUseExtendedBackgroundIdleMode​(boolean value)
        Enable extended background idle mode for any tcp sockets created. Enabling this mode asks the system to keep the socket open and delay reclaiming it when the process moves to the background (see https://developer.apple.com/library/ios/technotes/tn2277/_index.html)
      • setTLSMaximumSupportedProtocol

        public void setTLSMaximumSupportedProtocol​(int value)
        The maximum allowable versions of the TLS protocol, from
      • setTLSMinimumSupportedProtocol

        public void setTLSMinimumSupportedProtocol​(int value)
        The minimum allowable versions of the TLS protocol, from
      • setTimeoutIntervalForRequest

        public void setTimeoutIntervalForRequest​(double value)
        default timeout for requests. This will cause a timeout if no data is transmitted for the given timeout value, and is reset whenever data is transmitted.
      • setTimeoutIntervalForResource

        public void setTimeoutIntervalForResource​(double value)
        default timeout for requests. This will cause a timeout if a resource is not able to be retrieved within a given timeout.
      • setURLCache

        public void setURLCache​(NSURLCache value)
        The URL resource cache, or nil to indicate that no caching is to be performed
      • setURLCredentialStorage

        public void setURLCredentialStorage​(NSURLCredentialStorage value)
        The credential storage object, or nil to indicate that no credential storage is to be used
      • sharedContainerIdentifier

        public java.lang.String sharedContainerIdentifier()
        The identifier of the shared data container into which files in background sessions should be downloaded. App extensions wishing to use background sessions *must* set this property to a valid container identifier, or all transfers in that session will fail with NSURLErrorBackgroundSessionRequiresSharedContainer.
      • shouldUseExtendedBackgroundIdleMode

        public boolean shouldUseExtendedBackgroundIdleMode()
        Enable extended background idle mode for any tcp sockets created. Enabling this mode asks the system to keep the socket open and delay reclaiming it when the process moves to the background (see https://developer.apple.com/library/ios/technotes/tn2277/_index.html)
      • timeoutIntervalForRequest

        public double timeoutIntervalForRequest()
        default timeout for requests. This will cause a timeout if no data is transmitted for the given timeout value, and is reset whenever data is transmitted.
      • timeoutIntervalForResource

        public double timeoutIntervalForResource()
        default timeout for requests. This will cause a timeout if a resource is not able to be retrieved within a given timeout.
      • multipathServiceType

        public long multipathServiceType()
        multipath service type to use for connections. The default is NSURLSessionMultipathServiceTypeNone
      • setMultipathServiceType

        public void setMultipathServiceType​(long value)
        multipath service type to use for connections. The default is NSURLSessionMultipathServiceTypeNone
      • setWaitsForConnectivity

        public void setWaitsForConnectivity​(boolean value)
        Causes tasks to wait for network connectivity to become available, rather than immediately failing with an error (such as NSURLErrorNotConnectedToInternet) when it is not. When waiting for connectivity, the timeoutIntervalForRequest property does not apply, but the timeoutIntervalForResource property does. Unsatisfactory connectivity (that requires waiting) includes cases where the device has limited or insufficient connectivity for a task (e.g., only has a cellular connection but the allowsCellularAccess property is NO, or requires a VPN connection in order to reach the desired host). Default value is NO. Ignored by background sessions, as background sessions always wait for connectivity.
      • waitsForConnectivity

        public boolean waitsForConnectivity()
        Causes tasks to wait for network connectivity to become available, rather than immediately failing with an error (such as NSURLErrorNotConnectedToInternet) when it is not. When waiting for connectivity, the timeoutIntervalForRequest property does not apply, but the timeoutIntervalForResource property does. Unsatisfactory connectivity (that requires waiting) includes cases where the device has limited or insufficient connectivity for a task (e.g., only has a cellular connection but the allowsCellularAccess property is NO, or requires a VPN connection in order to reach the desired host). Default value is NO. Ignored by background sessions, as background sessions always wait for connectivity.
      • TLSMaximumSupportedProtocolVersion

        public short TLSMaximumSupportedProtocolVersion()
        The maximum allowable versions of the TLS protocol, from
      • TLSMinimumSupportedProtocolVersion

        public short TLSMinimumSupportedProtocolVersion()
        The minimum allowable versions of the TLS protocol, from
      • allowsConstrainedNetworkAccess

        public boolean allowsConstrainedNetworkAccess()
        allow request to route over networks in constrained mode. Defaults to YES.
      • allowsExpensiveNetworkAccess

        public boolean allowsExpensiveNetworkAccess()
        allow request to route over expensive networks. Defaults to YES.
      • setAllowsConstrainedNetworkAccess

        public void setAllowsConstrainedNetworkAccess​(boolean value)
        allow request to route over networks in constrained mode. Defaults to YES.
      • setAllowsExpensiveNetworkAccess

        public void setAllowsExpensiveNetworkAccess​(boolean value)
        allow request to route over expensive networks. Defaults to YES.
      • setTLSMaximumSupportedProtocolVersion

        public void setTLSMaximumSupportedProtocolVersion​(short value)
        The maximum allowable versions of the TLS protocol, from
      • setTLSMinimumSupportedProtocolVersion

        public void setTLSMinimumSupportedProtocolVersion​(short value)
        The minimum allowable versions of the TLS protocol, from