//
//  SHHttpClientProtocol.h
//  test
//
//  Created by 蒋 卫滨 on 13-3-22.
//  Copyright (c) 2013年 蒋 卫滨. All rights reserved.
//

#import <Foundation/Foundation.h>

#ifndef RELEASE_OBJ
#define RELEASE_OBJ(obj) if(obj) { [obj release]; obj = nil;}
#endif

@protocol SHHttpClientDelegateProtocol <NSObject>
@optional
-(void)onReceiveData:(id)client data:(NSData*)data error:(NSError*)error statusCode:(long)statusCode context:(id)context;
@end
//
@protocol SHHttpClientProtocol <NSObject>
@required
-(id)initWithDelegate:(id<SHHttpClientDelegateProtocol>)delegate onlyNotifyWhenEnd:(BOOL)onlyNotifyWhenEnd;
-(void)startWithRequst:(NSURLRequest*)request  context:(id)context;
-(void)startWithUrl:(NSString*)url  context:(id)context;
-(void)stop;
-(long)statusCode;
-(NSError* )error;
-(NSData*)rspData;
-(NSDictionary*)rspHeaders;
-(NSString*)rspHeaderForKey:(NSString*)key;
-(NSURLRequest*)request;
-(id<SHHttpClientDelegateProtocol>)delegate;
-(id)context;
-(BOOL)onlyNotifyWhenEnd;
@end

