Java Code Examples for com.google.gwt.http.client.RequestCallback

The following are top voted examples for showing how to use com.google.gwt.http.client.RequestCallback. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: empiria.player   File: SynchronousScriptsLoaderTest.java   View source code 6 votes vote down vote up
@Test
public void shouldFireOnLoad_afterLastScriptLoaded() {
    // given
    ScriptUrl[] scripts = new ScriptUrl[]{firstScript, secondScript};
    Request request = mock(Request.class);
    Response response = mock(Response.class);
    when(response.getText()).thenReturn(RESPONSE_TEXT);

    // when
    testObj.injectScripts(scripts, synchronousScriptsCallback);
    verify(requestWrapper).get(eq(FIRST_SCRIPT_URL), requestCallbackCaptor.capture());
    RequestCallback requestCallback = requestCallbackCaptor.getValue();
    requestCallback.onResponseReceived(request, response);

    // then
    verify(scriptInjectorWrapper).fromString(RESPONSE_TEXT);

    verify(requestWrapper).get(SECOND_SCRIPT_URL, requestCallback);
    requestCallback.onResponseReceived(request, response);
    verify(synchronousScriptsCallback).onLoad();
}
 
Example 2
Project: onecmdb   File: MDRStartWidget.java   View source code 6 votes vote down vote up
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());
	 } 
 }
}
 
Example 3
Project: firefly   File: RequestBuilderServerTask.java   View source code 6 votes vote down vote up
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);
        }
    }
 
Example 4
Project: firefly   File: HtmlRegionLoader.java   View source code 6 votes vote down vote up
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();
    }

}
 
Example 5
Project: turbogwt-http   File: RequestImpl.java   View source code 6 votes vote down vote up
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);
    }
}
 
Example 6
Project: turbogwt-http   File: ServerConnectionImpl.java   View source code 6 votes vote down vote up
@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);
}
 
Example 7
Project: OneCMDBwithMaven   File: MDRStartWidget.java   View source code 6 votes vote down vote up
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());
	 } 
 }
}
 
Example 8
Project: ineform   File: RestDataConnectorComplexTest.java   View source code 6 votes vote down vote up
private void prepareRequestBuilder(
    RequestBuilder requestBuilder,
    String responseText,
    int statusCode) throws Exception {
    final Response response = mock(Response.class);
    when(response.getStatusCode()).thenReturn(statusCode);
    when(response.getText()).thenReturn(responseText);

    when(requestBuilder.sendRequest(anyString(), any(RequestCallback.class)))
        .thenAnswer(new Answer<Request>() {

            @Override
            public Request answer(InvocationOnMock invocation) throws Throwable {
                ((RequestCallback) invocation.getArguments()[1])
                    .onResponseReceived(null, response);
                return null;
            }
        });
}
 
Example 9
Project: ineform   File: RestDataConnectorComplexTest.java   View source code 6 votes vote down vote up
@Test
public void createRequest() throws Exception {
    prepareRequestBuilder(requestBuilder, response.replace("'", "\""), 200);

    restDataConnector.objectCreateOrEditRequested(testKvo, callback);

    ArgumentCaptor<String> argument = ArgumentCaptor.forClass(String.class);
    verify(requestBuilder).sendRequest(argument.capture(), any(RequestCallback.class));
    Assert.assertEquals(response, argument.getValue());
    ArgumentCaptor<ObjectManipulationActionResult> omrCapture = ArgumentCaptor
        .forClass(ObjectManipulationActionResult.class);
    verify(callback).onManipulationResult(omrCapture.capture());

    TestUtil.assertEquals(
        testKvo,
        omrCapture.getValue().getObjectsNewState(),
        TestUtil.descriptorStore);

}
 
Example 10
Project: geomajas-project-client-gwt2   File: AbstractWfsServiceTest.java   View source code 6 votes vote down vote up
protected void prepareResponse(String resource) throws Exception {
	capabilitiesXml = IOUtils.toString(this.getClass().getResourceAsStream(resource), "UTF-8");
	DOMParser parser = new DOMParser();
	parser.parse(new InputSource(new StringReader(capabilitiesXml)));
	capabilitiesDoc = w3cToGoogle(parser.getDocument());
	final Response response = mock(Response.class);
	when(response.getStatusCode()).thenReturn(200);
	when(response.getText()).thenReturn(capabilitiesXml);

	when(requestBuilder.sendRequest(anyString(), any(RequestCallback.class))).thenAnswer(new Answer<Request>() {

		@Override
		public Request answer(InvocationOnMock invocation) throws Throwable {
			((RequestCallback) invocation.getArguments()[1]).onResponseReceived(null, response);
			return null;
		}
	});
}
 
Example 11
Project: geomajas-project-client-gwt2   File: AbstractWmsServiceTest.java   View source code 6 votes vote down vote up
protected void prepareResponse(String resource) throws Exception {
	capabilitiesXml = IOUtils.toString(this.getClass().getResourceAsStream(resource), "UTF-8");
	DOMParser parser = new DOMParser();
	parser.parse(new InputSource(new StringReader(capabilitiesXml)));
	capabilitiesDoc = w3cToGoogle(parser.getDocument());
	final Response response = mock(Response.class);
	when(response.getStatusCode()).thenReturn(200);
	when(response.getText()).thenReturn(capabilitiesXml);

	when(requestBuilder.sendRequest(anyString(), any(RequestCallback.class))).thenAnswer(new Answer<Request>() {

		@Override
		public Request answer(InvocationOnMock invocation) throws Throwable {
			((RequestCallback) invocation.getArguments()[1]).onResponseReceived(null, response);
			return null;
		}
	});
}
 
Example 12
Project: empiria.player   File: RequestWrapper.java   View source code 5 votes vote down vote up
public void get(String url, RequestCallback callback) {
    try {
        new RequestBuilder(RequestBuilder.GET, url).sendRequest("", callback);
    } catch (RequestException e) {
        logger.error(e);
    }
}
 
Example 13
Project: empiria.player   File: SynchronousScriptsLoader.java   View source code 5 votes vote down vote up
public void injectScripts(ScriptUrl[] scripts, SynchronousScriptsCallback callback) {
    Stack<ScriptUrl> scriptsStack = new Stack<>();
    Collections.addAll(scriptsStack, scripts);
    Collections.reverse(scriptsStack);

    RequestCallback nextScriptLoaderCallback = createNextScriptLoaderCallback(scriptsStack, callback);

    injectScript(scriptsStack, nextScriptLoaderCallback);
}
 
Example 14
Project: shortyz   File: ShortyzGadget.java   View source code 5 votes vote down vote up
public static native void makePostRequest(String url, String postdata,
    RequestCallback callback) /*-{
var response = function(obj) { 
    @com.totsp.crossword.web.gadget.ShortyzGadget::onSuccessInternal(Lcom/totsp/crossword/web/client/GadgetResponse;Lcom/google/gwt/http/client/RequestCallback;)(obj, callback);
};
var params = {};
params[$wnd.gadgets.io.RequestParameters.HEADERS] = {
"Content-Type": "text/x-gwt-rpc"
};
params[$wnd.gadgets.io.RequestParameters.METHOD] = $wnd.gadgets.io.MethodType.POST; 
params[$wnd.gadgets.io.RequestParameters.POST_DATA]= postdata; 
$wnd.gadgets.io.makeRequest(url, response, params);


}-*/;
 
Example 15
Project: shortyz   File: ShortyzGadget.java   View source code 5 votes vote down vote up
static void onSuccessInternal(final GadgetResponse response,
    RequestCallback callback) {
    try {
        callback.onResponseReceived(null, new FakeResponse(response));
    } catch (Exception e) {
        callback.onError(null, e);
    }
}
 
Example 16
Project: shortyz   File: ShortyzWave.java   View source code 5 votes vote down vote up
public static native void makePostRequest(String url, String postdata,
    RequestCallback callback) /*-{
var response = function(obj) {
@com.totsp.crossword.web.wave.ShortyzWave::onSuccessInternal(Lcom/totsp/crossword/web/client/GadgetResponse;Lcom/google/gwt/http/client/RequestCallback;)(obj, callback);
};
var params = {};
params[$wnd.gadgets.io.RequestParameters.HEADERS] = {
"Content-Type": "text/x-gwt-rpc"
};
params[$wnd.gadgets.io.RequestParameters.METHOD] = $wnd.gadgets.io.MethodType.POST;
params[$wnd.gadgets.io.RequestParameters.POST_DATA]= postdata;
$wnd.gadgets.io.makeRequest(url, response, params);


}-*/;
 
Example 17
Project: shortyz   File: ShortyzWave.java   View source code 5 votes vote down vote up
static void onSuccessInternal(final GadgetResponse response,
    RequestCallback callback) {
    try {
        callback.onResponseReceived(null, new FakeResponse(response));
    } catch (Exception e) {
        callback.onError(null, e);
    }
}
 
Example 18
Project: firefly   File: JsonUtils.java   View source code 5 votes vote down vote up
public static void jsonRequest(String baseUrl,
                               String cmd,
                               List<Param> paramList,
                               RequestCallback cb) throws RequestException {
    String url = makeURL(baseUrl, cmd, paramList, false);
    RequestBuilder builder = new RequestBuilder(RequestBuilder.GET, url);
    builder.setCallback(cb);
    builder.send();
}
 
Example 19
Project: turbogwt-http   File: RequestImpl.java   View source code 5 votes vote down vote up
private <T, C extends Collection> RequestPromise<Collection<T>> send(RequestBuilder.Method method,
                                                                     Class<T> responseType,
                                                                     Class<C> containerType) {
    final DeferredCollectionResult<T> deferred = new DeferredCollectionResult<T>(responseType, containerType,
            serdesManager, containerFactoryManager);

    RequestCallback callback = createRequestCallback(deferred);

    dispatch(method, callback);

    return deferred;
}
 
Example 20
Project: turbogwt-http   File: ServerConnectionMock.java   View source code 5 votes vote down vote up
@Override
public void sendRequest(RequestBuilder.Method method, String url, String data, RequestCallback callback)
        throws RequestException {
    ServerStub.setRequestData(url, new RequestMock(method, url, data));
    uri = url;
    requestCallback = (RequestCallbackWithProgress) callback;
}
 
Example 21
Project: turbogwt-http   File: ServerConnectionMock.java   View source code 5 votes vote down vote up
@Override
public void sendRequest(int timeout, String user, String password, Headers headers, RequestBuilder.Method method,
                        String url, String data, RequestCallback callback) throws RequestException {
    ServerStub.setRequestData(url, new RequestMock(method, url, data, headers));
    uri = url;
    requestCallback = (RequestCallbackWithProgress) callback;
}
 
Example 22
Project: socom   File: AudioInfluenceStrategy.java   View source code 5 votes vote down vote up
@Override
public void updateFreeAnswerOnUploadSuccess(
	final InfluenceFreeAnswerViewInterface<AnswerAudio> answer,
	SimpleEntry<String, String>[] sourceParameter, final JSONValue result) {
	final String filePath = result.isObject().get("file").isString().stringValue();
	
	fileDetectionTimer = new Timer() {

		@Override
		public void run() {
			RequestBuilder builder = new RequestBuilder(RequestBuilder.GET, GWT.getHostPageBaseURL() + getDataPath(filePath));

		    try {
		      builder.sendRequest(null, new RequestCallback() {
		        public void onError(Request request, Throwable exception) {
		          AudioInfluenceStrategy.this.presenter.showError(unkownError);
		        }

		        public void onResponseReceived(Request request, Response response) {
		          if(response.getStatusCode() == 404)
		          {
		        	  AudioInfluenceStrategy.this.presenter.showError(notReadyError);
		          }
		          else
		          {
		        	  fileDetectionTimer.cancel();
		        	  onFreeAnswerFileReady(answer, result);
		          }
		        }
		      });
		    } catch (RequestException e) {
		    	AudioInfluenceStrategy.this.presenter.showError(unkownError);
		    }
		}
	};
	
	fileDetectionTimer.scheduleRepeating(500);
}
 
Example 23
Project: opennmszh   File: DefaultChartService.java   View source code 5 votes vote down vote up
private void sendRequest(String url, RequestCallback callback) {
    RequestBuilder builder = new RequestBuilder(RequestBuilder.GET, URL.encode(url));
    builder.setHeader("Accept", "application/json");
    
    builder.setUser("ipv6Rest");
    builder.setPassword("ipv6Rest");
    try {
        builder.sendRequest(null, callback);
    } catch (RequestException e) {
        e.printStackTrace();
    }
}
 
Example 24
Project: opennmszh   File: DefaultNodeService.java   View source code 5 votes vote down vote up
public void findSnmpInterfacesMatching(int nodeId, String parameter, String value, RequestCallback callback) {
    String url = BASE_URL + nodeId + "/snmpinterfaces?" + parameter + "=" + value;
    if(!parameter.equals("ifIndex") && !parameter.equals("ifSpeed")) {
        url += "&comparator=contains";
    }
    url += "&limit=0";
    sendRequest(callback, url);
    
}
 
Example 25
Project: opennmszh   File: DefaultNodeService.java   View source code 5 votes vote down vote up
private void sendRequest(RequestCallback callback, String url) {
    RequestBuilder builder = new RequestBuilder(RequestBuilder.GET, URL.encode(url));
    builder.setHeader("accept", "application/json");
    try {
        builder.sendRequest(null, callback);
    } catch (RequestException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}
 
Example 26
Project: opennmszh   File: DefaultKscReportService.java   View source code 5 votes vote down vote up
@Override
public void addGraphToReport(final RequestCallback callback, final int kscReportId, final String graphTitle, final String graphName, final String resourceId, final String timeSpan) {
    UrlBuilder builder = new UrlBuilder();
    builder.setPath(BASE_URL + "/" + kscReportId);
    builder.setParameter("title", graphTitle);
    builder.setParameter("reportName", graphName);
    builder.setParameter("resourceId", resourceId);
    builder.setParameter("timespan", timeSpan);

    // we just want a relative URL, so we render it and strip the beginning :)
    final String url = builder.buildString().replace("http:///", "");
    GWT.log("making request: " + url);
    sendRequest(callback, RequestBuilder.PUT, url);
}
 
Example 27
Project: opennmszh   File: DefaultKscReportService.java   View source code 5 votes vote down vote up
private void sendRequest(final RequestCallback callback, final Method method, final String url) {
    final RequestBuilder builder = new RequestBuilder(method, url);
    builder.setHeader("accept", "application/json");
    try {
        builder.sendRequest(null, callback);
    } catch (final RequestException e) {
        e.printStackTrace();
    }
}
 
Example 28
Project: opennmszh   File: DefaultNodeService.java   View source code 5 votes vote down vote up
private void sendRequest(RequestCallback callback, String url) {
    RequestBuilder builder = new RequestBuilder(RequestBuilder.GET, URL.encode(url));
    builder.setHeader("accept", "application/json");
    try {
        builder.sendRequest(null, callback);
    } catch (RequestException e) {
        e.printStackTrace();
    }
}
 
Example 29
Project: Peergos   File: ContentWidget.java   View source code 5 votes vote down vote up
/**
 * Send a request for source code.
 * 
 * @param callback the {@link RequestCallback} to send
 * @param urlSuffix the URL to target, relative to the Showcase module's base URL.
 */
private void sendSourceRequest(RequestCallback callback, String urlSuffix) {
  // When Super Dev Mode is on, we will load it from the code server, not the original server.
  String url = GWT.getModuleBaseForStaticFiles() + urlSuffix;
  RequestBuilder builder = new RequestBuilder(RequestBuilder.GET, url);
  builder.setCallback(callback);
  try {
    builder.send();
  } catch (RequestException e) {
    callback.onError(null, e);
  }
}
 
Example 30
Project: swarm   File: ContentWidget.java   View source code 5 votes vote down vote up
/**
 * Send a request for source code.
 * 
 * @param callback the {@link RequestCallback} to send
 * @param urlSuffix the URL to target, relative to the Showcase module's base URL.
 */
private void sendSourceRequest(RequestCallback callback, String urlSuffix) {
  // When Super Dev Mode is on, we will load it from the code server, not the original server.
  String url = GWT.getModuleBaseForStaticFiles() + urlSuffix;
  RequestBuilder builder = new RequestBuilder(RequestBuilder.GET, url);
  builder.setCallback(callback);
  try {
    builder.send();
  } catch (RequestException e) {
    callback.onError(null, e);
  }
}
 
Example 31
Project: OpenNMS   File: DefaultChartService.java   View source code 5 votes vote down vote up
private void sendRequest(String url, RequestCallback callback) {
    RequestBuilder builder = new RequestBuilder(RequestBuilder.GET, URL.encode(url));
    builder.setHeader("Accept", "application/json");
    
    builder.setUser("ipv6Rest");
    builder.setPassword("ipv6Rest");
    try {
        builder.sendRequest(null, callback);
    } catch (RequestException e) {
        e.printStackTrace();
    }
}
 
Example 32
Project: OpenNMS   File: DefaultNodeService.java   View source code 5 votes vote down vote up
public void findSnmpInterfacesMatching(int nodeId, String parameter, String value, RequestCallback callback) {
    String url = BASE_URL + nodeId + "/snmpinterfaces?" + parameter + "=" + value;
    if(!parameter.equals("ifIndex") && !parameter.equals("ifSpeed")) {
        url += "&comparator=contains";
    }
    url += "&limit=0";
    sendRequest(callback, url);
    
}
 
Example 33
Project: OpenNMS   File: DefaultNodeService.java   View source code 5 votes vote down vote up
private void sendRequest(RequestCallback callback, String url) {
    RequestBuilder builder = new RequestBuilder(RequestBuilder.GET, URL.encode(url));
    builder.setHeader("accept", "application/json");
    try {
        builder.sendRequest(null, callback);
    } catch (RequestException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}
 
Example 34
Project: OpenNMS   File: DefaultNodeService.java   View source code 5 votes vote down vote up
public void findSnmpInterfacesMatching(int nodeId, String parameter, String value, RequestCallback callback) {
    String url = BASE_URL + nodeId + "/snmpinterfaces?" + parameter + "=" + value;
    if(!parameter.equals("ifIndex") && !parameter.equals("ifSpeed")) {
        url += "&comparator=contains";
    }
    url += "&limit=0";
    sendRequest(callback, url);
    
}
 
Example 35
Project: OpenNMS   File: DefaultNodeService.java   View source code 5 votes vote down vote up
private void sendRequest(RequestCallback callback, String url) {
    RequestBuilder builder = new RequestBuilder(RequestBuilder.GET, URL.encode(url));
    builder.setHeader("accept", "application/json");
    try {
        builder.sendRequest(null, callback);
    } catch (RequestException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}
 
Example 36
Project: OpenNMS   File: DefaultKscReportService.java   View source code 5 votes vote down vote up
@Override
public void addGraphToReport(final RequestCallback callback, final int kscReportId, final String graphTitle, final String graphName, final String resourceId, final String timeSpan) {
    UrlBuilder builder = new UrlBuilder();
    builder.setPath(BASE_URL + "/" + kscReportId);
    builder.setParameter("title", graphTitle);
    builder.setParameter("reportName", graphName);
    builder.setParameter("resourceId", resourceId);
    builder.setParameter("timespan", timeSpan);

    // we just want a relative URL, so we render it and strip the beginning :)
    final String url = builder.buildString().replace("http:///", "");
    GWT.log("making request: " + url);
    sendRequest(callback, RequestBuilder.PUT, url);
}
 
Example 37
Project: OpenNMS   File: DefaultKscReportService.java   View source code 5 votes vote down vote up
private void sendRequest(final RequestCallback callback, final Method method, final String url) {
    final RequestBuilder builder = new RequestBuilder(method, url);
    builder.setHeader("accept", "application/json");
    try {
        builder.sendRequest(null, callback);
    } catch (final RequestException e) {
        e.printStackTrace();
    }
}
 
Example 38
Project: OpenNMS   File: DefaultKscReportService.java   View source code 5 votes vote down vote up
@Override
public void addGraphToReport(final RequestCallback callback, final int kscReportId, final String graphTitle, final String graphName, final String resourceId, final String timeSpan) {
    UrlBuilder builder = new UrlBuilder();
    builder.setPath(BASE_URL + "/" + kscReportId);
    builder.setParameter("title", graphTitle);
    builder.setParameter("reportName", graphName);
    builder.setParameter("resourceId", resourceId);
    builder.setParameter("timespan", timeSpan);

    // we just want a relative URL, so we render it and strip the beginning :)
    final String url = builder.buildString().replace("http:///", "");
    GWT.log("making request: " + url);
    sendRequest(callback, RequestBuilder.PUT, url);
}
 
Example 39
Project: OpenNMS   File: DefaultKscReportService.java   View source code 5 votes vote down vote up
private void sendRequest(final RequestCallback callback, final Method method, final String url) {
    final RequestBuilder builder = new RequestBuilder(method, url);
    builder.setHeader("accept", "application/json");
    try {
        builder.sendRequest(null, callback);
    } catch (final RequestException e) {
        e.printStackTrace();
    }
}
 
Example 40
Project: OpenNMS   File: DefaultNodeService.java   View source code 5 votes vote down vote up
private void sendRequest(RequestCallback callback, String url) {
    RequestBuilder builder = new RequestBuilder(RequestBuilder.GET, URL.encode(url));
    builder.setHeader("accept", "application/json");
    try {
        builder.sendRequest(null, callback);
    } catch (RequestException e) {
        e.printStackTrace();
    }
}