ROHTTPAsyncRequest

Overview

Location


 

backgroundTasksEnabled    (declared in ROAsyncRequest)

Returns YES if OS supports background tasks, NO othervise.

+ (BOOL) backgroundTasksEnabled

cancel    (declared in ROAsyncRequest)

Aborts the currently running request.

Note: because the status of the current request may be indeterminate and the request may already have been dispatched and executed on the server, sending this message is no guarantee that the requested action will not be performed. Depending on the underlying communication channel, it might also not be possible to skip retrieval of a (possibly large) response message. Sending the cancel message merely indicates that the caller is no longer interested in this request being completed.

- (void) cancel

canceled    (declared in ROAsyncRequest)

Boolean property shows was asynchonous request canceled or not.

@property (readonly) BOOL canceled

channel    (declared in ROAsyncRequest)

The client channel that the request is being executed for. Read-only and mainly for reference and internal use.

@property (readonly) ROClientChannel *channel

checkActivityForThread:    (declared in ROAsyncRequest)

- (void) checkActivityForThread:(NSThread *)aThread

Parameters:

  • aThread:

connection  retain

@property (retain) NSURLConnection *connection

context  retain    (declared in ROAsyncRequest)

represents the context of given asynchronous request. It can be any object you need to pass along with async request.

For example:

if ([[request context] isKindOfClass:[MyTest class]]) {
  [(MyTest *)[request context] performSomeTests];
}   
@property (retain) id context

delegate  assign    (declared in ROAsyncRequest)

The delegate to send messages to for updates on progress, success or failure of the request.

@property (assign) id delegate

done    (declared in ROAsyncRequest)

The message that is being sent. Read-only and mainly for reference and internal use.

@property (readonly) BOOL done

exception    (declared in ROAsyncRequest)

This property stores the exception instance from the last run of the asynchronous request

@property (readonly) NSException *exception

failureBlock  copy    (declared in ROAsyncRequest)

given block of code will be executed if asynchronous request will fail with any exception. For example:

    NSString *sql = [NSString stringWithFormat:@"SELECT TOP %ld * FROM [%@]", limit, tableName];
    [self setBusy:YES];
    
    DAAsyncRequest *ar = [[self adapter] beginGetDataTable:tableName withSQL:sql start:NO];
    [ar setDelegate:self];
    [ar setFailureBlock:^(NSException *exception){
        
        [self setBusy:NO];
        [tableView setEnabled:NO];
        [tables selectItem:nil];        
        [Helpers showAlertSheetForException:exception inWindow:self.view.window];
        
    }];
    [ar startWithBlock:^{
        [self setBusy:NO];
        
        previewTable = [[ar tables] objectAtIndex:0];
        [Helpers prepareTableView:tableView
                         forTable:previewTable];
        [tableView setEnabled:YES];
        [previewDataSource setArray:[previewTable rows]];
    }];
@property (copy) void(^)(NSException *) failureBlock

failWithException:    (declared in ROAsyncRequest)

- (void) failWithException:(NSException *)exception

Parameters:

  • exception:

intCancel    (declared in ROAsyncRequest)

- (void) intCancel

message    (declared in ROAsyncRequest)

Represents reference to request message

@property (readonly) ROMessage *message

messageName    (declared in ROAsyncRequest)

Represents the request name. It can be used for particular request identification when handling requests by delegate methods. For example:

- (void)asyncRequestDidComplete:(ROAsyncRequest *)request {
    @try {
        if ([@"GetDbSchemaNames" compare:[request messageName]] == NSOrderedSame) {
            StringArray *names = [[domain asyncSchemaModelerService] endGetDbSchemaNames:request];
            [self setDbSchemaNames:[names array]];
        }
        else if ([@"GetTableNames" compare:[request messageName]] == NSOrderedSame) {
            StringArray *names = [[domain asyncSchemaModelerService] endGetTableNames:request];
            [self setTableNames:[names array]];   
        }
        else if ([@"GetViewNames" compare:[request messageName]] == NSOrderedSame) {
            StringArray *names = [[domain asyncSchemaModelerService] endGetViewNames:request];
            [self setViewNames:[names array]];   
        }
    }
}
@property (readonly) NSString *messageName

originatingQueue    (declared in ROAsyncRequest)

@property (readonly) dispatch_queue_t originatingQueue

originatingThread    (declared in ROAsyncRequest)

Keeps the reference to NSThread object on which given request was started.

If asynchronous request was started in usual way (not startOnMainThread/startOnMainThreadWithBlock:) then completion block, as well and failure block will be executed at the originating thread

@property (readonly) NSThread *originatingThread

proxy  retain    (declared in ROAsyncRequest)

Keeps the reference to the service proxy instance.

In most of cases it set automatically in auto-generated code for the service interface.

@property (retain) id proxy

request  retain

@property (retain) NSURLRequest *request

requestDidComplete    (declared in ROAsyncRequest)

- (void) requestDidComplete

requestDidFailWithException:    (declared in ROAsyncRequest)

- (void) requestDidFailWithException:(NSException *)exception

Parameters:

  • exception:

responseData    (declared in ROAsyncRequest)

The data that is being received. Read-only and mainly for reference and internal use.

@property (readonly) NSData *responseData

responseMessage    (declared in ROAsyncRequest)

Represents a response message (a message that contains the request result that came from the server-side)

@property (readonly) ROMessage *responseMessage

restart    (declared in ROAsyncRequest)

- (void) restart

retried  assign    (declared in ROAsyncRequest)

@property (assign) BOOL retried

setBackgroundTasksEnabled:    (declared in ROAsyncRequest)

Set YES if given OS supports background tasks, NO othervise.

+ (void) setBackgroundTasksEnabled:(BOOL)value

Parameters:

  • value:

setChannel:    (declared in ROAsyncRequest)

- (void) setChannel:(ROClientChannel *)channel

Parameters:

  • channel:

setMessage:    (declared in ROAsyncRequest)

- (void) setMessage:(ROMessage *)message

Parameters:

  • message:

start    (declared in ROAsyncRequest)

Starts the request, if it is not already running. While the request itself will be executed in the background, the current thread will be considered the request's context and any callbacks to the delegate will happen on the thread that sent the start message.

If start is sent to a request that is already running, then ROAsyncRequestActiveException will be thrown.

- (void) start

startInBackground    (declared in ROAsyncRequest)

Starts the request, if it is not already running. The request itself will be executed in the background, regardless how it was started. However, any callbacks to the delegate will happen on a background thread and not the thread that started the request. The identity of this background thread is undefined and may depend on the underlying communication structure.

If startInBackground is sent to a request that is already running, a ROAsyncRequestActiveException will be thrown.

- (void) startInBackground

startInBackgroundWithBlock:    (declared in ROAsyncRequest)

Starts the request with given completion block. The request itself will be executed in the background, regardless how it was started. However, any callbacks to the delegate and the completion block itself will happen on a background thread and not the thread that started the request.

The identity of this background thread is undefined and may depend on the underlying communication structure.

If startInBackground is sent to a request that is already running, an ROAsyncRequestActiveException will be thrown.

- (void) startInBackgroundWithBlock:(void(^)(ROAsyncRequest *))block

Parameters:

  • block: Completion block. Will be executed in the caller (background) thread.

startOnDispatchQueue:    (declared in ROAsyncRequest)

This method is not implemented yet. Calling it will raise an exception.

- (void) startOnDispatchQueue:(dispatch_queue_t)queue

Parameters:

  • queue:

startOnMainThread    (declared in ROAsyncRequest)

Starts the request with instruction to execute any callbacks to the delegate in the the main UI thread, regardless from what thread given request was started.

- (void) startOnMainThread

startOnMainThreadWithBlock:    (declared in ROAsyncRequest)

Starts the request with given completion block with instruction to execute this block, as well any callbacks to the delegate in the the main UI thread, regardless from what thread given request was started

- (void) startOnMainThreadWithBlock:(void(^)(ROAsyncRequest *))block

Parameters:

  • block: Completion block. Will be called after async request ends

startWithBlock:    (declared in ROAsyncRequest)

Starts the request whith given completion block. While the request itself will be executed in the background, the current thread will be considered the request's context and any callbacks to the delegate will happen on the thread that sent the start message.

If we apply this method to already running request, then ROAsyncRequestActiveException will be thrown.

- (void) startWithBlock:(void(^)(ROAsyncRequest *))block

Parameters:

  • block: Completion block. Will be called after async request ends

 

canceled    (declared in ROAsyncRequest)

Boolean property shows was asynchonous request canceled or not.

@property (readonly) BOOL canceled

channel    (declared in ROAsyncRequest)

The client channel that the request is being executed for. Read-only and mainly for reference and internal use.

@property (readonly) ROClientChannel *channel

connection  retain

@property (retain) NSURLConnection *connection

context  retain    (declared in ROAsyncRequest)

represents the context of given asynchronous request. It can be any object you need to pass along with async request.

For example:

if ([[request context] isKindOfClass:[MyTest class]]) {
  [(MyTest *)[request context] performSomeTests];
}   
@property (retain) id context

delegate  assign    (declared in ROAsyncRequest)

The delegate to send messages to for updates on progress, success or failure of the request.

@property (assign) id delegate

done    (declared in ROAsyncRequest)

The message that is being sent. Read-only and mainly for reference and internal use.

@property (readonly) BOOL done

exception    (declared in ROAsyncRequest)

This property stores the exception instance from the last run of the asynchronous request

@property (readonly) NSException *exception

failureBlock  copy    (declared in ROAsyncRequest)

given block of code will be executed if asynchronous request will fail with any exception. For example:

    NSString *sql = [NSString stringWithFormat:@"SELECT TOP %ld * FROM [%@]", limit, tableName];
    [self setBusy:YES];
    
    DAAsyncRequest *ar = [[self adapter] beginGetDataTable:tableName withSQL:sql start:NO];
    [ar setDelegate:self];
    [ar setFailureBlock:^(NSException *exception){
        
        [self setBusy:NO];
        [tableView setEnabled:NO];
        [tables selectItem:nil];        
        [Helpers showAlertSheetForException:exception inWindow:self.view.window];
        
    }];
    [ar startWithBlock:^{
        [self setBusy:NO];
        
        previewTable = [[ar tables] objectAtIndex:0];
        [Helpers prepareTableView:tableView
                         forTable:previewTable];
        [tableView setEnabled:YES];
        [previewDataSource setArray:[previewTable rows]];
    }];
@property (copy) void(^)(NSException *) failureBlock

message    (declared in ROAsyncRequest)

Represents reference to request message

@property (readonly) ROMessage *message

messageName    (declared in ROAsyncRequest)

Represents the request name. It can be used for particular request identification when handling requests by delegate methods. For example:

- (void)asyncRequestDidComplete:(ROAsyncRequest *)request {
    @try {
        if ([@"GetDbSchemaNames" compare:[request messageName]] == NSOrderedSame) {
            StringArray *names = [[domain asyncSchemaModelerService] endGetDbSchemaNames:request];
            [self setDbSchemaNames:[names array]];
        }
        else if ([@"GetTableNames" compare:[request messageName]] == NSOrderedSame) {
            StringArray *names = [[domain asyncSchemaModelerService] endGetTableNames:request];
            [self setTableNames:[names array]];   
        }
        else if ([@"GetViewNames" compare:[request messageName]] == NSOrderedSame) {
            StringArray *names = [[domain asyncSchemaModelerService] endGetViewNames:request];
            [self setViewNames:[names array]];   
        }
    }
}
@property (readonly) NSString *messageName

originatingQueue    (declared in ROAsyncRequest)

@property (readonly) dispatch_queue_t originatingQueue

originatingThread    (declared in ROAsyncRequest)

Keeps the reference to NSThread object on which given request was started.

If asynchronous request was started in usual way (not startOnMainThread/startOnMainThreadWithBlock:) then completion block, as well and failure block will be executed at the originating thread

@property (readonly) NSThread *originatingThread

proxy  retain    (declared in ROAsyncRequest)

Keeps the reference to the service proxy instance.

In most of cases it set automatically in auto-generated code for the service interface.

@property (retain) id proxy

request  retain

@property (retain) NSURLRequest *request

responseData    (declared in ROAsyncRequest)

The data that is being received. Read-only and mainly for reference and internal use.

@property (readonly) NSData *responseData

responseMessage    (declared in ROAsyncRequest)

Represents a response message (a message that contains the request result that came from the server-side)

@property (readonly) ROMessage *responseMessage

retried  assign    (declared in ROAsyncRequest)

@property (assign) BOOL retried

 

backgroundTasksEnabled    (declared in ROAsyncRequest)

Returns YES if OS supports background tasks, NO othervise.

+ (BOOL) backgroundTasksEnabled

setBackgroundTasksEnabled:    (declared in ROAsyncRequest)

Set YES if given OS supports background tasks, NO othervise.

+ (void) setBackgroundTasksEnabled:(BOOL)value

Parameters:

  • value:

 

cancel    (declared in ROAsyncRequest)

Aborts the currently running request.

Note: because the status of the current request may be indeterminate and the request may already have been dispatched and executed on the server, sending this message is no guarantee that the requested action will not be performed. Depending on the underlying communication channel, it might also not be possible to skip retrieval of a (possibly large) response message. Sending the cancel message merely indicates that the caller is no longer interested in this request being completed.

- (void) cancel

checkActivityForThread:    (declared in ROAsyncRequest)

- (void) checkActivityForThread:(NSThread *)aThread

Parameters:

  • aThread:

failWithException:    (declared in ROAsyncRequest)

- (void) failWithException:(NSException *)exception

Parameters:

  • exception:

intCancel    (declared in ROAsyncRequest)

- (void) intCancel

requestDidComplete    (declared in ROAsyncRequest)

- (void) requestDidComplete

requestDidFailWithException:    (declared in ROAsyncRequest)

- (void) requestDidFailWithException:(NSException *)exception

Parameters:

  • exception:

restart    (declared in ROAsyncRequest)

- (void) restart

setChannel:    (declared in ROAsyncRequest)

- (void) setChannel:(ROClientChannel *)channel

Parameters:

  • channel:

setMessage:    (declared in ROAsyncRequest)

- (void) setMessage:(ROMessage *)message

Parameters:

  • message:

start    (declared in ROAsyncRequest)

Starts the request, if it is not already running. While the request itself will be executed in the background, the current thread will be considered the request's context and any callbacks to the delegate will happen on the thread that sent the start message.

If start is sent to a request that is already running, then ROAsyncRequestActiveException will be thrown.

- (void) start

startInBackground    (declared in ROAsyncRequest)

Starts the request, if it is not already running. The request itself will be executed in the background, regardless how it was started. However, any callbacks to the delegate will happen on a background thread and not the thread that started the request. The identity of this background thread is undefined and may depend on the underlying communication structure.

If startInBackground is sent to a request that is already running, a ROAsyncRequestActiveException will be thrown.

- (void) startInBackground

startInBackgroundWithBlock:    (declared in ROAsyncRequest)

Starts the request with given completion block. The request itself will be executed in the background, regardless how it was started. However, any callbacks to the delegate and the completion block itself will happen on a background thread and not the thread that started the request.

The identity of this background thread is undefined and may depend on the underlying communication structure.

If startInBackground is sent to a request that is already running, an ROAsyncRequestActiveException will be thrown.

- (void) startInBackgroundWithBlock:(void(^)(ROAsyncRequest *))block

Parameters:

  • block: Completion block. Will be executed in the caller (background) thread.

startOnDispatchQueue:    (declared in ROAsyncRequest)

This method is not implemented yet. Calling it will raise an exception.

- (void) startOnDispatchQueue:(dispatch_queue_t)queue

Parameters:

  • queue:

startOnMainThread    (declared in ROAsyncRequest)

Starts the request with instruction to execute any callbacks to the delegate in the the main UI thread, regardless from what thread given request was started.

- (void) startOnMainThread

startOnMainThreadWithBlock:    (declared in ROAsyncRequest)

Starts the request with given completion block with instruction to execute this block, as well any callbacks to the delegate in the the main UI thread, regardless from what thread given request was started

- (void) startOnMainThreadWithBlock:(void(^)(ROAsyncRequest *))block

Parameters:

  • block: Completion block. Will be called after async request ends

startWithBlock:    (declared in ROAsyncRequest)

Starts the request whith given completion block. While the request itself will be executed in the background, the current thread will be considered the request's context and any callbacks to the delegate will happen on the thread that sent the start message.

If we apply this method to already running request, then ROAsyncRequestActiveException will be thrown.

- (void) startWithBlock:(void(^)(ROAsyncRequest *))block

Parameters:

  • block: Completion block. Will be called after async request ends