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


Java RequestException類代碼示例

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


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

示例1: onCancel

import com.google.gwt.http.client.RequestException; //導入依賴的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: doJsonRequest

import com.google.gwt.http.client.RequestException; //導入依賴的package包/類
private void doJsonRequest(String url, String username, String password, JSONControllerCallback callback, Integer timeout) {
	RequestBuilder builder = new RequestBuilder(RequestBuilder.GET, url);
	Request request = null;
	
	// Add accept header
	builder.setHeader("Accept", "application/json");
	
	if (username != null && username.length() > 0) {
		if (password == null) password = "";
		
		// Add authentication header
		String authStr = username + ":" + password;
		String authEnc = "Basic " + BrowserUtils.base64Encode(authStr);
		builder.setHeader("Authorization", authEnc);
	}
	
	builder.setCallback(callback);
	
	if (timeout != null) {
		builder.setTimeoutMillis(timeout);
	}
	
   try {
 		request = builder.send();
   } catch (RequestException e) {
 		callback.onError(request, e);
   }
}
 
開發者ID:openremote,項目名稱:WebConsole,代碼行數:29,代碼來源:JSONControllerConnector.java

示例3: init

import com.google.gwt.http.client.RequestException; //導入依賴的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

示例4: testBadSerialization3

import com.google.gwt.http.client.RequestException; //導入依賴的package包/類
public void testBadSerialization3() throws RequestException {
	final boolean[] callbackFired = new boolean[] { false };

	RequestBuilder rb = getService().echoRequestBuilder(
			new MixedSerializable.NonSerializableSub(),
			new AsyncCallback<MixedSerializable>() {
				@Override
				public void onFailure(Throwable caught) {
					assertFalse("callback fired twice", callbackFired[0]);
					callbackFired[0] = true;
				}

				@Override
				public void onSuccess(MixedSerializable result) {
					fail("RPC request should have failed");
				}
			});

	assertFalse(callbackFired[0]); // should fail when send() is called
	rb.send();
	assertTrue(callbackFired[0]); // should have happened now
}
 
開發者ID:jcricket,項目名稱:gwt-syncproxy,代碼行數:23,代碼來源:RunTimeSerializationErrorsTest.java

示例5: testManualSend

import com.google.gwt.http.client.RequestException; //導入依賴的package包/類
public void testManualSend() throws RequestException {
	RemoteServiceServletTestServiceAsync service = getAsyncService();

	delayTestFinishForRpc();

	RequestBuilder builder = service
			.testExpectCustomHeader(new AsyncCallback<Void>() {

				@Override
				public void onFailure(Throwable caught) {
					TestSetValidator.rethrowException(caught);
				}

				@Override
				public void onSuccess(Void result) {
					assertTrue(!RemoteServiceServletTest.this.req
							.isPending());
					finishTest();
				}
			});

	builder.setHeader("X-Custom-Header", "true");
	this.req = builder.send();
	assertTrue(this.req.isPending());
}
 
開發者ID:jcricket,項目名稱:gwt-syncproxy,代碼行數:26,代碼來源:RemoteServiceServletTest.java

示例6: testManualSend

import com.google.gwt.http.client.RequestException; //導入依賴的package包/類
public void testManualSend() throws RequestException {
	fail("Request Builder Not Supported");
	final RemoteServiceServletTestServiceAsync service = getAsyncService();

	delayTestFinishForRpc();

	setTask(new AsyncTask<Void, Void, Void>() {

		@Override
		protected Void doInBackground(Void... arg0) {
			RequestBuilder builder = service
					.testExpectCustomHeader(new AsyncCallback<Void>() {

						@Override
						public void onFailure(Throwable caught) {
							TestSetValidator.rethrowException(caught);
						}

						@Override
						public void onSuccess(Void result) {
							assertTrue(!RemoteServiceServletTest.this.req
									.isPending());
							finishTest();
						}
					});
			builder.setHeader("X-Custom-Header", "true");
			try {
				RemoteServiceServletTest.this.req = builder.send();
			} catch (RequestException e) {
				throw new RuntimeException(e);
			}
			assertTrue(RemoteServiceServletTest.this.req.isPending());
			return null;
		}
	});
}
 
開發者ID:jcricket,項目名稱:gwt-syncproxy,代碼行數:37,代碼來源:RemoteServiceServletTest.java

示例7: doStop

import com.google.gwt.http.client.RequestException; //導入依賴的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

示例8: start

import com.google.gwt.http.client.RequestException; //導入依賴的package包/類
void start(RequestCallback callback) {
//        taskRunningCnt++;
//        showDebugTask();
//        runningList.add(this);
        if (_state!= State.START) {
            throw new IllegalStateException("Server task must be in the START state to call start(). "+
                                            "Current state: "+ _state+
                                            " You can return to the start state using reset()");
        }
        _state= State.WORKING;
        if(isAutoMask) {
            mask();
        }
        _activeCallback= callback;
        try {
//            startTime= System.currentTimeMillis();
            doTask(callback);
        } catch (RequestException e) {
            doFailure(e);
        }
    }
 
開發者ID:lsst,項目名稱:firefly,代碼行數:22,代碼來源:RequestBuilderServerTask.java

示例9: load

import com.google.gwt.http.client.RequestException; //導入依賴的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

示例10: dispatch

import com.google.gwt.http.client.RequestException; //導入依賴的package包/類
private void dispatch(RequestBuilder.Method method, RequestCallback callback) {
    ensureHeaders();

    // Execute filters on this request
    final List<RequestFilter> filters = filterManager.getRequestFilters();
    for (RequestFilter filter : filters) {
        filter.filter(this);
    }

    String body = serializePayload();

    ServerConnection connection = server.getConnection();

    try {
        connection.sendRequest(timeout, user, password, headers, method, uri, body, callback);
    } catch (final RequestException e) {
        throw new RequestDispatchException("It was not possible to dispatch the request.", e);
    }
}
 
開發者ID:growbit,項目名稱:turbogwt-http,代碼行數:20,代碼來源:RequestImpl.java

示例11: sendRequest

import com.google.gwt.http.client.RequestException; //導入依賴的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

示例12: ajax

import com.google.gwt.http.client.RequestException; //導入依賴的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

示例13: executeSqlRequest

import com.google.gwt.http.client.RequestException; //導入依賴的package包/類
@Override
public void executeSqlRequest(final DatabaseConfigurationDTO configuration,
                              final int resultLimit,
                              final String sqlRequest,
                              final MultipleRequestExecutionMode execMode,
                              final AsyncRequestCallback<String> asyncRequestCallback)
                                                                                      throws RequestException {
    final String url = formatUrl(restServiceContext, ServicePaths.EXECUTE_SQL_REQUEST_PATH, "", null);
    final RequestParameterDTO requestParameterDTO = dtoFactory.createDto(RequestParameterDTO.class)
                                                              .withDatabase(configuration)
                                                              .withResultLimit(resultLimit)
                                                              .withSqlRequest(sqlRequest)
                                                              .withMultipleRequestExecutionMode(execMode);
    final AsyncRequest postRequest = asyncRequestFactory.createPostRequest(url, requestParameterDTO, false);
    postRequest.send(asyncRequestCallback);
}
 
開發者ID:codenvy-legacy,項目名稱:plugin-datasource,代碼行數:17,代碼來源:DatasourceClientServiceImpl.java

示例14: fetch

import com.google.gwt.http.client.RequestException; //導入依賴的package包/類
@Override
public void fetch() {
    try {
        datasourceClientService.getAvailableDrivers(new AsyncRequestCallback<String>(new StringUnmarshaller()) {
            @Override
            protected void onSuccess(String result) {
                DriversDTO driversDto = dtoFactory.createDtoFromJson(result, DriversDTO.class);
                drivers = driversDto.getDrivers();
                eventBus.fireEvent(new JdbcDriversFetchedEvent(drivers));
            }

            @Override
            protected void onFailure(Throwable exception) {
                notificationManager.showNotification(new Notification("Failed getting available JDBC drivers from server: "
                                                                      + exception.getMessage(), Type.ERROR));
            }
        });
    } catch (RequestException e) {
        notificationManager.showNotification(new Notification("Failed getting available JDBC drivers from server: " + e.getMessage(),
                                                              Type.ERROR));
    }
}
 
開發者ID:codenvy-legacy,項目名稱:plugin-datasource,代碼行數:23,代碼來源:AvailableJdbcDriversServiceRestImpl.java

示例15: onClickTestConnectionButton

import com.google.gwt.http.client.RequestException; //導入依賴的package包/類
@Override
public void onClickTestConnectionButton() {
    if (getView().isPasswordFieldDirty()) {
        try {
            service.encryptText(getView().getPassword(), new AsyncRequestCallback<String>(new StringUnmarshaller()) {
                @Override
                protected void onSuccess(final String encryptedText) {
                    TextDTO encryptedTextDTO = dtoFactory.createDtoFromJson(encryptedText, TextDTO.class);
                    getView().setEncryptedPassword(encryptedTextDTO.getValue(), false);
                    doOnClickTestConnectionButton();
                }

                @Override
                protected void onFailure(Throwable exception) {
                    Log.error(DefaultNewDatasourceConnectorViewImpl.class, exception);
                }
            });
        } catch (RequestException e2) {
            Log.error(DefaultNewDatasourceConnectorViewImpl.class, e2);
        }
    }
    else {
        doOnClickTestConnectionButton();
    }

}
 
開發者ID:codenvy-legacy,項目名稱:plugin-datasource,代碼行數:27,代碼來源:AbstractNewDatasourceConnectorPage.java


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