org.alfresco.bm.json
Class JSONArrayCallback

java.lang.Object
  extended by org.alfresco.bm.json.JSONArrayCallback
All Implemented Interfaces:
AuthenticatedHttpEventProcessor.HttpRequestCallback<org.json.simple.JSONArray>

public class JSONArrayCallback
extends Object
implements AuthenticatedHttpEventProcessor.HttpRequestCallback<org.json.simple.JSONArray>

A AuthenticatedHttpEventProcessor.HttpRequestCallback that parses the response body as a JSONArrayin the 'data' property (RestConstants#JSON_DATA) of the JSON body.
An exception is thrown when JSON could not be extracted.

Author:
Frederik Heremans

Constructor Summary
JSONArrayCallback()
           
 
Method Summary
 org.json.simple.JSONArray onCallSuccess(org.apache.commons.httpclient.HttpMethod method)
          Called when call was successful.
 boolean onError(org.apache.commons.httpclient.HttpMethod method, Throwable t)
          Called when an error occurs when sending the request.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JSONArrayCallback

public JSONArrayCallback()
Method Detail

onCallSuccess

public org.json.simple.JSONArray onCallSuccess(org.apache.commons.httpclient.HttpMethod method)
Description copied from interface: AuthenticatedHttpEventProcessor.HttpRequestCallback
Called when call was successful.

Specified by:
onCallSuccess in interface AuthenticatedHttpEventProcessor.HttpRequestCallback<org.json.simple.JSONArray>
Parameters:
method - the method executed which can be used to extract response from.
Returns:
any result extracted from the response body.

onError

public boolean onError(org.apache.commons.httpclient.HttpMethod method,
                       Throwable t)
Description copied from interface: AuthenticatedHttpEventProcessor.HttpRequestCallback
Called when an error occurs when sending the request.

Specified by:
onError in interface AuthenticatedHttpEventProcessor.HttpRequestCallback<org.json.simple.JSONArray>
Parameters:
method - the method executed
t - optional exception that caused the error
Returns:
true, if error is handled. False, if an exception should be thrown.


Copyright © 2012. All Rights Reserved.