当前位置: 首页>>代码示例>>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;未经允许,请勿转载。