Up
Authors
- Generated by root
-
- Declared in:
- Foundation/NSURLProtocol.h
Availability: MacOS-X 10.2.0, Base 1.13.0
Subclasses of NSURLProtocol implement basic handling of URL loading for specific protocols. The NSURLProtocol class itsself is a semi-abstract class giving the essential structure for the subclasses.
You never instantiate NSURLProtocol yourself... it should only ever be done by other classes within mthe URL loading system.
Method summary
+ (id)
propertyForKey: (
NSString*)key
inRequest: (
NSURLRequest*)request;
Availability: MacOS-X 10.2.0, Base 1.13.0
Allows subclasses to provide access to proptocol specific properties, returning the property of request stored by the name key or nil
if no property had been stored using that key in the request.
+ (BOOL)
registerClass: (Class)protocolClass;
Availability: MacOS-X 10.2.0, Base 1.13.0
Registers the specified class so that it can be used to load requests.
When the system is determining which class to use to handle a request it examines them in a most recently registered first order.
The
+canInitWithRequest:
method is used to determine whether a class may be used to handle a particular request or not. Returns
YES
if registered (ie the class is an NSURLProtocol subclass),
NO
otherwise.
+ (void)
setProperty: (id)value
forKey: (
NSString*)key
inRequest: (
NSMutableURLRequest*)request;
Availability: MacOS-X 10.2.0, Base 1.13.0
Allows subclasses to provide a way to set protocol specific properties, setting the property named key to value in the request.
+ (void)
unregisterClass: (Class)protocolClass;
Availability: MacOS-X 10.2.0, Base 1.13.0
Unregisters a class which was previously registered using the
+registerClass:
method.
- (
NSCachedURLResponse*)
cachedResponse;
Availability: MacOS-X 10.2.0, Base 1.13.0
Returns the cachedResponse of the receiver.
- (id<
NSURLProtocolClient>)
client;
Availability: MacOS-X 10.2.0, Base 1.13.0
Returns the client associated with the receiver.
- (id)
initWithRequest: (
NSURLRequest*)request
cachedResponse: (
NSCachedURLResponse*)cachedResponse
client: (id<
NSURLProtocolClient>)client;
Availability: MacOS-X 10.2.0, Base 1.13.0
Initialises the receiver with request, cachedResponse and client.
The cachedResponse may be the result of a previous load of the request (in which case the protocol may validate and use it).
The client is the object which receives messages about the progress of the load.
- (
NSURLRequest*)
request;
Availability: MacOS-X 10.2.0, Base 1.13.0
Returns the request handled by the receiver.
- Declared in:
- Foundation/NSURLProtocol.h
Availability: MacOS-X 10.2.0, Base 1.13.0
This category lists the methods which a subclass must implement in order to produce a working protocol.
Method summary
+ (BOOL)
canInitWithRequest: (
NSURLRequest*)request;
Availability: MacOS-X 10.2.0, Base 1.13.0
Subclasses
should override this method.
This method is called to decide whether a class can deal with the specified request. The abstract class implementation raises an exception.
+ (
NSURLRequest*)
canonicalRequestForRequest: (
NSURLRequest*)request;
Availability: MacOS-X 10.2.0, Base 1.13.0
Subclasses
should override this method.
Returns the 'canonical' version of the request.
The canonical form is used to look up requests in the cache by checking for equality.
The abnstract class implementation simply returns request.
+ (BOOL)
requestIsCacheEquivalent: (
NSURLRequest*)a
toRequest: (
NSURLRequest*)b;
Availability: MacOS-X 10.2.0, Base 1.13.0
Subclasses
should override this method.
Compares two requests for equivalence for caching purposes.
The abstract class implementaton just uses
[NSObject -isEqual:]
- (void)
startLoading;
Availability: MacOS-X 10.2.0, Base 1.13.0
Subclasses
should override this method.
Starts loading of a request.
- (void)
stopLoading;
Availability: MacOS-X 10.2.0, Base 1.13.0
Subclasses
should override this method.
Stops loading of a request (eg when the load is cancelled).
- Declared in:
- Foundation/NSURLProtocol.h
- Conforms to:
- NSObject
Availability: MacOS-X 10.2.0, Base 1.13.0
Defines the API for NSURLProtocol loading
Method summary
- (void)
URLProtocol: (
NSURLProtocol*)protocol
cachedResponseIsValid: (
NSCachedURLResponse*)cachedResponse;
Availability: MacOS-X 10.2.0, Base 1.13.0
Informs a client that a cached response is valid.
- (void)
URLProtocol: (
NSURLProtocol*)protocol
didCancelAuthenticationChallenge: (
NSURLAuthenticationChallenge*)challenge;
Availability: MacOS-X 10.2.0, Base 1.13.0
Informs a client that an authentication challenge has been cancelled.
- (void)
URLProtocol: (
NSURLProtocol*)protocol
didFailWithError: (
NSError*)error;
Availability: MacOS-X 10.2.0, Base 1.13.0
Informs a client that loading of a request has failed.
- (void)
URLProtocol: (
NSURLProtocol*)protocol
didLoadData: (
NSData*)data;
Availability: MacOS-X 10.2.0, Base 1.13.0
Informs a client that data has been loaded. Only new data since the last call to this method must be provided.
- (void)
URLProtocol: (
NSURLProtocol*)protocol
didReceiveAuthenticationChallenge: (
NSURLAuthenticationChallenge*)challenge;
Availability: MacOS-X 10.2.0, Base 1.13.0
Informs a client that an authentication challenge has been received.
- (void)
URLProtocol: (
NSURLProtocol*)protocol
didReceiveResponse: (
NSURLResponse*)response
cacheStoragePolicy: (
NSURLCacheStoragePolicy)policy;
Availability: MacOS-X 10.2.0, Base 1.13.0
Informs a client that a response for the current load has been created.
Also supplies the policy to be used for caching the response.
- (void)
URLProtocol: (
NSURLProtocol*)protocol
wasRedirectedToRequest: (
NSURLRequest*)request
redirectResponse: (
NSURLResponse*)redirectResponse;
Availability: MacOS-X 10.2.0, Base 1.13.0
Informs a client that a redirect has occurred.
- (void)
URLProtocolDidFinishLoading: (
NSURLProtocol*)protocol;
Availability: MacOS-X 10.2.0, Base 1.13.0
Informs a client that loading of a request has successfully finished.
Up