Example usage for com.google.gwt.resources.client ResourceException ResourceException

List of usage examples for com.google.gwt.resources.client ResourceException ResourceException

Introduction

In this page you can find the example usage for com.google.gwt.resources.client ResourceException ResourceException.

Prototype

public ResourceException(ResourcePrototype resource, String msg, Throwable t) 

Source Link

Usage

From source file:org.vectomatic.dom.svg.impl.ExternalSVGResourcePrototype.java

License:Apache License

/**
 * Possibly fire off an HTTPRequest for the SVG resource.
 * @param callback The request callback/* w ww  .j a  va 2 s. co m*/
 */
public void getSvg(ResourceCallback<SVGResource> callback) throws ResourceException {

    // If we've already parsed the JSON bundle, short-circuit.
    if (cache[index] != null) {
        callback.onSuccess(cache[index]);
        return;
    }

    // Otherwise, fire an HTTP request.
    RequestBuilder rb = new RequestBuilder(RequestBuilder.GET, url);
    try {
        rb.sendRequest("", new ESRCallback(callback));
    } catch (RequestException e) {
        throw new ResourceException(this, "Unable to initiate request for external resource", e);
    }
}