public PromiseReqBuilderJSONP(String url, int timeout) {
this(url, null, timeout);
}
public PromiseReqBuilderJSONP(String url, String callbackParam, int timeout) {
JsonpRequestBuilder builder = new JsonpRequestBuilder();
if (timeout > 0) {
builder.setTimeout(timeout);
}
// jQuery allows a parameter callback=? to figure out the callback parameter
if (callbackParam == null) {
MatchResult tmp = callbackRegex.exec(url);
if (tmp != null && tmp.getGroupCount() == 4) {
callbackParam = tmp.getGroup(2);
url = tmp.getGroup(1) + tmp.getGroup(3);
}
}
if (callbackParam != null) {
builder.setCallbackParam(callbackParam);
}
send(builder, url, new AsyncCallback<Object>() {
public void onFailure(Throwable caught) {
dfd.reject(caught);
}