Advertise here




Advertise here

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Google Sign In with OpenID
Please do not post the same thing multiple times. The board software automatically flags certain posts as needing moderator attention. This happens the most often for new users. I'm pretty sure this is made clear at the time you attempt to post. Posting the same thing over and over again just makes that many more posts the moderators have to weed through later. This makes us sad. Don't make us sad. If your post/thread doesn't appear, just wait a while. Don't post it again. If it hasn't shown up by the next day, then you can try again. I normally go through posts in the mornings, and try to check a few times throughout the day, but I'm not here 24/7. There will typically be a significant delay before posts are approved. Just be patient.

Get HTTP Header with a UIWebView

geeogeeo Posts: 31Registered Users
Hi,

I'm creating an URL and then using it for an URLRequest. Then I use a UIWebView to display the URL. But I can't access to informations about the request :


   NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@\"http://%@:%@/wa/r/%@?OutputMap=%@\", app_url, app_port, app_name, app_theme]];
// [myLabel setText:[url description]];

// Load URL
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:60.0];
// iosWV -> webview
[iosWV loadRequest:requestObj];

NSLog(@\"HTTPMethod %@\", [requestObj HTTPMethod]);
NSLog(@\"URL %@\", [requestObj URL]);
NSLog(@\"mainDocumentURL %@\", [requestObj mainDocumentURL]);

NSLog(@\"allHTTPHeaderFields %@\", [requestObj allHTTPHeaderFields]);
NSLog(@\"HTTPBody %@\", [requestObj HTTPBody]);
NSLog(@\"HTTPShouldHandlePipelining %@\", [requestObj HTTPShouldUsePipelining]);


Give following output :
2012-05-21 15:26:11.236 Genero[3112:f803] HTTPMethod GET
2012-05-21 15:26:11.238 Genero[3112:f803] URL http://localhost:6363/wa/r/gwc-demo?OutputMap=DUA_HTML5
2012-05-21 15:26:11.238 Genero[3112:f803] mainDocumentURL (null)
2012-05-21 15:26:11.239 Genero[3112:f803] allHTTPHeaderFields (null)
2012-05-21 15:26:11.239 Genero[3112:f803] HTTPBody (null)
2012-05-21 15:26:11.240 Genero[3112:f803] HTTPShouldHandlePipelining (null)
I don't know what to do to access to the other data.

Thanks in advance :)
Post edited by geeo on

Replies

  • FstuffFstuff Posts: 154Registered Users
    Well you can access some of the information. Assuming that the webView is not somehow changing the NSURLRequest (you should check on this), perhaps the issue has to do with your logging. The methods that you are having trouble with all return various class objects rather than NSStrings. Perhaps you could check to see if the calls are in fact returning nil.
Sign In or Register to comment.