For a code example, see Make Long-Running Callouts from a Visualforce Page.
The following are constructors for Continuation.
public Continuation(Integer timeout)
The following are properties for Continuation.
public Object state {get; set;}
Type: Object
This example shows how to save state information for a continuation in a controller.
// Declare inner class to hold state info private class StateInfo { String msg { get; set; } List<String> urls { get; set; } StateInfo(String msg, List<String> urls) { this.msg = msg; this.urls = urls; } } // Then in the action method, set state for the continuation continuationInstance.state = new StateInfo('Some state data', urls);
The following are methods for Continuation.
public String addHttpRequest(System.HttpRequest request)
Type: String
A unique label that identifies the HTTP request that is associated with this continuation. This label is used in the map that getRequests() returns to identify individual requests in a continuation.
You can add up tothree requests to a continuation.
public Map<String,System.HttpRequest> getRequests()
Type: Map<String,HttpRequest>
A map of all requests that are associated with this continuation. The map key is the request label, and the map value is the corresponding HTTP request.
public static HttpResponse getResponse(String requestLabel)
Type: HttpResponse
The status code is returned in the HttpResponse object and can be obtained by calling getStatusCode() on the response. A status code of 200 indicates that the request was successful. Other status code values indicate the type of problem that was encountered.
Sample of Error Status Codes