當前位置: 首頁>>代碼示例>>Java>>正文


Java RequestBuilder.sendRequest方法代碼示例

本文整理匯總了Java中com.google.gwt.http.client.RequestBuilder.sendRequest方法的典型用法代碼示例。如果您正苦於以下問題:Java RequestBuilder.sendRequest方法的具體用法?Java RequestBuilder.sendRequest怎麽用?Java RequestBuilder.sendRequest使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.google.gwt.http.client.RequestBuilder的用法示例。


在下文中一共展示了RequestBuilder.sendRequest方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onCancel

import com.google.gwt.http.client.RequestBuilder; //導入方法依賴的package包/類
@Override
public void onCancel(CancelEvent event) {
	if (event.getID().equals("Correlation")) {
		currentURL = currentURL + "&cancel=true";
		RequestBuilder sendRequest = new RequestBuilder(
				RequestBuilder.GET, currentURL);
		try {

			lasAnnotationsPanel
					.setError("Fetching plot annotations...");
			sendRequest.sendRequest(null, lasRequestCallback);
		} catch (RequestException e) {
			Window.alert("Unable to cancel request.");
		}
	}
}
 
開發者ID:NOAA-PMEL,項目名稱:LAS,代碼行數:17,代碼來源:Correlation.java

示例2: init

import com.google.gwt.http.client.RequestBuilder; //導入方法依賴的package包/類
public void init(LASRequest request, String cruiseid) {
  	message.setVisible(false);
  	request.setOperation("Cruise_List", "v7");
  	List<Map<String, String>> c = request.getVariableConstraints();
  	for (Iterator cIt = c.iterator(); cIt.hasNext();) {
	Map<String, String> map = (Map<String, String>) cIt.next();
	String varid = map.get("varID");
	if ( varid.equals(cruiseid)) {
		
	} else {
		
	}
}
String url = Util.getProductServer()+"?xml="+URL.encode(request.toString());
  	RequestBuilder sendRequest = new RequestBuilder(RequestBuilder.GET, UriUtils.sanitizeUri(url));
try {
	sendRequest.sendRequest(null, iconListRequestCallback);
} catch (RequestException e) {
	message.setVisible(true);
	message.setHTML("Unable to icon list");
}
  }
 
開發者ID:NOAA-PMEL,項目名稱:LAS,代碼行數:23,代碼來源:CruiseIconWidget.java

示例3: doStop

import com.google.gwt.http.client.RequestBuilder; //導入方法依賴的package包/類
public void doStop() {
 for (TabItem item : advanced.getItems()) {
	 final CIModel model = (CIModel)item.getData("model");

	 // Do a HTTP request..
	 RequestBuilder req = new RequestBuilder(RequestBuilder.GET, getStopURL(model));

	 try {
		 Info.display("Stop", "Send stop to " + model.getDisplayName());
		 req.sendRequest(null, new RequestCallback() {

			 public void onResponseReceived(Request request, Response response) {
				 Info.display("Stop", "COMPLETED. Stop sent to " + model.getDisplayName());
			 }

			 public void onError(Request arg0, Throwable arg1) {
				 Info.display("Stop", "FAILED. to stop " + model.getDisplayName());
			 }
		 });

	 } catch (RequestException e) {
		 Info.display("Stop", "ERROR. to stop " + model.getDisplayName());
	 } 
 }
}
 
開發者ID:luox12,項目名稱:onecmdb,代碼行數:26,代碼來源:MDRStartWidget.java

示例4: load

import com.google.gwt.http.client.RequestBuilder; //導入方法依賴的package包/類
public void load(String url, final String regionName) {
    RequestBuilder builder = new RequestBuilder(RequestBuilder.GET, url);
    try {
        builder.sendRequest(null, new RequestCallback(){
            public void onResponseReceived(com.google.gwt.http.client.Request req, Response res) {
                updateHtml(res.getText(), regionName);
            }

            public void onError(com.google.gwt.http.client.Request request, Throwable exception) {
            }
        });
    } catch (RequestException e) {
        e.printStackTrace();
    }

}
 
開發者ID:lsst,項目名稱:firefly,代碼行數:17,代碼來源:HtmlRegionLoader.java

示例5: sendRequest

import com.google.gwt.http.client.RequestBuilder; //導入方法依賴的package包/類
@Override
public void sendRequest(int timeout, @Nullable String user, @Nullable String password, @Nullable Headers headers,
                        RequestBuilder.Method method, String url, String data, RequestCallback callback)
        throws RequestException {
    final RequestBuilder requestBuilder = new RequestBuilder(method, url);
    if (timeout > 0) requestBuilder.setTimeoutMillis(timeout);
    if (user != null) requestBuilder.setUser(user);
    if (password != null) requestBuilder.setPassword(password);
    if (user != null && password != null) requestBuilder.setIncludeCredentials(true);
    if (headers != null) {
        for (Header header : headers) {
            requestBuilder.setHeader(header.getName(), header.getValue());
        }
    }
    requestBuilder.sendRequest(data, callback);
}
 
開發者ID:growbit,項目名稱:turbogwt-http,代碼行數:17,代碼來源:ServerConnectionImpl.java

示例6: ajax

import com.google.gwt.http.client.RequestBuilder; //導入方法依賴的package包/類
private void ajax(final String resource, final String body,
                  final AjaxCallback callback) {
  final boolean has_body = body != null;
  final RequestBuilder builder =
    new RequestBuilder(has_body ? RequestBuilder.POST : RequestBuilder.GET,
                       server + resource);
  // Doesn't work on Chrome due to ES bug #828.
  //if (has_body) {
  //  builder.setHeader("Content-Type", "application/json");
  //}
  try {
    builder.sendRequest(body, callback);
  } catch (RequestException e) {
    status.setText("Failed to setup AJAX call to " + server + resource
                   + ": " + e);
  }
}
 
開發者ID:tsuna,項目名稱:droopy,代碼行數:18,代碼來源:Main.java

示例7: setAnnotationsHTMLURL

import com.google.gwt.http.client.RequestBuilder; //導入方法依賴的package包/類
public void setAnnotationsHTMLURL(String url) {
	RequestBuilder sendRequest = new RequestBuilder(RequestBuilder.GET, url);
	try {
		sendRequest.sendRequest(null, annotationsHTMLCallback);
	} catch (RequestException e) {
		
	}
}
 
開發者ID:NOAA-PMEL,項目名稱:LAS,代碼行數:9,代碼來源:LASAnnotationsButton.java

示例8: setAnnotationsHTMLURL

import com.google.gwt.http.client.RequestBuilder; //導入方法依賴的package包/類
public void setAnnotationsHTMLURL(String url) {
	RequestBuilder sendRequest = new RequestBuilder(RequestBuilder.GET, UriUtils.sanitizeUri(url));
	try {
		sendRequest.sendRequest(null, annotationsHTMLCallback);
	} catch (RequestException e) {
		e.printStackTrace();
	}
}
 
開發者ID:NOAA-PMEL,項目名稱:LAS,代碼行數:9,代碼來源:LASAnnotationsPanel.java

示例9: PrintPanel

import com.google.gwt.http.client.RequestBuilder; //導入方法依賴的package包/類
public PrintPanel(String url) {
	RequestBuilder builder = new RequestBuilder(RequestBuilder.GET, url);
	initWidget(panel);
	try {
		builder.sendRequest(null, fillPanelCallback);
	} catch (RequestException e) {
		HTMLPanel html = new HTMLPanel("<b>Unable to retrieve image.</b>");		
		panel.add(html);
	}
}
 
開發者ID:NOAA-PMEL,項目名稱:LAS,代碼行數:11,代碼來源:PrintPanel.java

示例10: updatePlot

import com.google.gwt.http.client.RequestBuilder; //導入方法依賴的package包/類
private void updatePlot(boolean addHistory, boolean cache) {
    // TODO Before submitting...

    
    setConstraints();
    
    //TODO this should wait until the result comes back and is good and should be an event, right?
    update.removeStyleDependentName("APPLY-NEEDED");

    lasAnnotationsPanel.setError("Fetching plot...");

    spin.setPopupPosition(outputPanel.getAbsoluteLeft(), outputPanel.getAbsoluteTop());
    spin.show();

    makeRequest(true);
   
    imageCanvas = Canvas.createIfSupported();
    drawingCanvas = Canvas.createIfSupported();

    
    
    if (imageCanvas != null) {

        canvasDiv.add(imageCanvas, 0, 0);
        canvasDiv.add(drawingCanvas, 0, 0);
        outputPanel.setWidget(1, 0, canvasDiv);
        imageCanvasContext = imageCanvas.getContext2d();
        drawingCanvasContext = drawingCanvas.getContext2d();
        
    } else {
        outputPanel.setWidget(1, 0 , new HTML(""));
        Window.alert("You are accessing this site with an older, no longer supported browser. "
                + "Some or all features of this site will not work correctly using your browser. " + "Recommended browsers include these or higher versions of these: "
                + "IE 9.0   FF 17.0    Chorme 23.0    Safari 5.1");
    }

    String url = Util.getProductServer() + "?xml=" + URL.encode(lasRequest.toString());

    currentURL = url;
    
    if ( cache ) {
        lasRequest.setProperty("product_server", "use_cache", "true");
    } else {
        lasRequest.setProperty("product_server", "use_cache", "false");
    }

    if (addHistory) {
        String x = lasRequest.toString();
        pushHistory(x);
    }

    RequestBuilder sendRequest = new RequestBuilder(RequestBuilder.GET, url);
    try {
        sendRequest.sendRequest(null, lasRequestCallback);
    } catch (RequestException e) {
        HTML error = new HTML(e.toString());
        outputPanel.setWidget(2, 0, error);
    }

}
 
開發者ID:NOAA-PMEL,項目名稱:LAS,代碼行數:61,代碼來源:SimplePropPropViewer.java

示例11: onCancel

import com.google.gwt.http.client.RequestBuilder; //導入方法依賴的package包/類
@Override
public void onCancel(CancelEvent event) {
    if (event.getID().equals("Correlation")) {
        currentURL = currentURL + "&cancel=true";
        RequestBuilder sendRequest = new RequestBuilder(RequestBuilder.GET, currentURL);
        try {

            lasAnnotationsPanel.setError("Fetching plot annotations...");
            sendRequest.sendRequest(null, lasRequestCallback);
        } catch (RequestException e) {
            Window.alert("Unable to cancel request.");
        }
    }
}
 
開發者ID:NOAA-PMEL,項目名稱:LAS,代碼行數:15,代碼來源:SimplePropPropViewer.java

示例12: sendPlot

import com.google.gwt.http.client.RequestBuilder; //導入方法依賴的package包/類
private void sendPlot(LASRequest lr0) {
    currentRequest = lr0;
    String url = Util.getProductServer() + "?xml=" + URL.encode(lr0.toString());
    RequestBuilder sendRequest = new RequestBuilder(RequestBuilder.GET, url);
    try {
        sendRequest.sendRequest(null, lasRequestCallback);
    } catch (RequestException e) {
        Window.alert("Unable to make plot requests.");
    }
}
 
開發者ID:NOAA-PMEL,項目名稱:LAS,代碼行數:11,代碼來源:ThumbnailPropProp.java

示例13: run

import com.google.gwt.http.client.RequestBuilder; //導入方法依賴的package包/類
protected void run() {
  if (!gssLoaded.contains(url)) {
    RequestBuilder rb = new RequestBuilder(RequestBuilder.GET, url);
    try {
      rb.sendRequest("", this);
    } catch (Exception e) {
      next();
    }
  } else {
    next();
  }
}
 
開發者ID:codeaudit,項目名稱:gwt-chronoscope,代碼行數:13,代碼來源:GssStyleElementGssContext.java

示例14: sendJSON

import com.google.gwt.http.client.RequestBuilder; //導入方法依賴的package包/類
private <T extends JavaScriptObject> void sendJSON(
    Method method, JavaScriptObject content, HttpCallback<T> cb) {
  HttpImpl<T> httpCallback = new HttpImpl<>(background, cb);
  try {
    if (!background) {
      RpcStatus.INSTANCE.onRpcStart();
    }
    RequestBuilder req = request(method);
    req.setHeader("Content-Type", JSON_UTF8);
    req.sendRequest(str(content), httpCallback);
  } catch (RequestException e) {
    httpCallback.onError(null, e);
  }
}
 
開發者ID:gerrit-review,項目名稱:gerrit,代碼行數:15,代碼來源:RestApi.java

示例15: sendText

import com.google.gwt.http.client.RequestBuilder; //導入方法依賴的package包/類
private <T extends JavaScriptObject> void sendText(
    Method method, String body, HttpCallback<T> cb) {
  HttpImpl<T> httpCallback = new HttpImpl<>(background, cb);
  try {
    if (!background) {
      RpcStatus.INSTANCE.onRpcStart();
    }
    RequestBuilder req = request(method);
    req.setHeader("Content-Type", TEXT_UTF8);
    req.sendRequest(body, httpCallback);
  } catch (RequestException e) {
    httpCallback.onError(null, e);
  }
}
 
開發者ID:gerrit-review,項目名稱:gerrit,代碼行數:15,代碼來源:RestApi.java


注:本文中的com.google.gwt.http.client.RequestBuilder.sendRequest方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。