Re: NSUrlResponse
Re: NSUrlResponse
- Subject: Re: NSUrlResponse
- From: Mark Ackerman <email@hidden>
- Date: Mon, 11 Jul 2005 08:12:43 -0400
On Jul 11, 2005, at 6:18 AM, Marco Maniscalco wrote:
Can anyone tell me how to retrieve a HTTP header field
from a NSURLResponse?
Is the NSURLResponse actually a NSHTTPURLResponse (sublcass of
NSURLResponse)? If so, the allHeaderFields accessor method should get
what you need.
For example, in the connection:didReceiveResponse: delegate method of
NSURLConnection, if the connection is using the HTTP protocol, the
following would get the header field info:
- (void)connection:(NSURLConnection *)connection didReceiveResponse:
(NSURLResponse *)response
{
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *)response;
NSDictionary *httpResponseHeaderFields = [httpResponse
allHeaderFields];
NSLog(@"Connection did receive response: %@",
httpResponseHeaderFields);
}
(This most likely isn't how you'd actually want to implement the
connection:didReceiveResponse: method since the response might not be
an instance of NSHTTPURLResponse, etc.etc, but just trying to show
the concept.)
Also, the accessor methods for NSURLResponse (MIMEType,
expectedContentLength, suggestedFileName, etc.) might get what you need.
You're probably aware, but here's a link to good info on the URL
Loading System:
http://developer.apple.com/documentation/Cocoa/Conceptual/
URLLoadingSystem/index.html#//apple_ref/doc/uid/10000165i
Mark
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
References: | |
| >NSUrlResponse (From: Marco Maniscalco <email@hidden>) |