5 // Created by Ichi Kanaya on 11/04/21.
6 // Copyright 2011 大阪大学. All rights reserved.
9 #import "DiracURLLoader.h"
12 @implementation DiracURLLoader
14 @synthesize connection;
20 // Initialization code here.
31 - (void)connection: (NSURLConnection *)connection didReceiveResponse: (NSURLResponse *)response {
32 self.data = [NSMutableData data];
35 - (void)connection: (NSURLConnection *)connection didReceiveData: (NSData *)receiveData {
36 [self.data appendData:receiveData];
39 - (void)connectionDidFinishLoading: (NSURLConnection *)connection {
40 [[NSNotificationCenter defaultCenter] postNotificationName: @"connectionDidFinishNotification"
44 - (void)connection: (NSURLConnection *)connection didFailWithError: (NSError *)error {
45 [[NSNotificationCenter defaultCenter] postNotificationName: @"connectionDidFailWithError"
49 - (void)loadFromUrl: (NSString *)url method: (NSString *) method {
50 NSMutableURLRequest *req = [NSMutableURLRequest requestWithURL: [NSURL URLWithString: url]];
51 [req setHTTPMethod: method];
52 self.connection = [NSURLConnection connectionWithRequest: req delegate: self];