Package com.google.gwt.http.client

Examples of com.google.gwt.http.client.RequestBuilder


public class GWTConnector {
    public static void send(final String httpBase, final String request, final ConnectorCallback listener)
      throws ConnectorException {
  Log.debug("GWT CONNECTOR SEND: " + request);
  final RequestBuilder builder = new RequestBuilder(RequestBuilder.POST, httpBase);
  try {
      builder.sendRequest(request, new RequestCallback() {
    public void onError(final Request arg0, final Throwable throwable) {
        Log.debug("GWT CONNECTOR ERROR: " + throwable);
        listener.onError(request, throwable);
    }
View Full Code Here


     
     
    }
    private JsonFile generateJsonFile(DataResource dataRes){
      final JsonFile json=new JsonFile(dataRes.getSafeUri().asString());
      RequestBuilder reqBuilder = new RequestBuilder(RequestBuilder.GET, json.getUrl());
      try {
        reqBuilder.sendRequest(null, new RequestCallback(){

          @Override
          public void onResponseReceived(Request request,Response response) {
            json.set(response.getText());
            assetOnLoad(json);
View Full Code Here

      super();
      this.markerUrl = markerUrl;
    }

    public void execute() {
      RequestBuilder builder = new RequestBuilder(RequestBuilder.GET,
          markerUrl);

      try {
        builder.setTimeoutMillis(2000);

        markerRequestSentAt = System.currentTimeMillis();

        builder.sendRequest(null, new RequestCallback() {
          public void onError(Request request, Throwable e) {
            if (e instanceof RequestTimeoutException) {
              log(1,
                  "Timeout fetching marker data: "
                      + e.getMessage());
View Full Code Here

            uri += (repaintAll || configuration.usePortletURLs() ? "&" : "?")
                    + "windowName=" + windowName;
        }

        if (!forceSync) {
            final RequestBuilder rb = new RequestBuilder(RequestBuilder.POST,
                    uri);
            // TODO enable timeout
            // rb.setTimeoutMillis(timeoutMillis);
            rb.setHeader("Content-Type", "text/plain;charset=utf-8");
            try {
                rb.sendRequest(rd, new RequestCallback() {
                    public void onError(Request request, Throwable exception) {
                        showCommunicationError(exception.getMessage());
                        endRequest();
                        if (!applicationRunning) {
                            // start failed, let's try to start the next app
View Full Code Here

  }

  private RequestBuilder getSendBuilder() {
    String endpoint = OUT_SERVICE_ENTRY_POINT;

    RequestBuilder builder = new RequestBuilder(
            RequestBuilder.POST,
            URL.encode(endpoint) + "?z=" + getNextRequestNumber()
    );

    builder.setHeader("Content-Type", "application/json");
    builder.setHeader(ClientMessageBus.REMOTE_QUEUE_ID_HEADER, clientId);

    return builder;
  }
View Full Code Here

  }

  private RequestBuilder getRecvBuilder() {
    String endpoint = IN_SERVICE_ENTRY_POINT;

    RequestBuilder builder = new RequestBuilder(
            RequestBuilder.GET,
            URL.encode(endpoint) + "?z=" + getNextRequestNumber()
    );

    builder.setHeader("Content-Type", "application/json");
    builder.setHeader(ClientMessageBus.REMOTE_QUEUE_ID_HEADER, clientId);
    return builder;
  }
View Full Code Here

      LogUtil.log("sending initial handshake to remote bus");

      String initialMessage = "{\"CommandType\":\"ConnectToQueue\",\"ToSubject\":\"ServerBus\"," +
              " \"PriorityProcessing\":\"1\"}";

      RequestBuilder initialRequest = getSendBuilder();
      initialRequest.setHeader("phase", "connection");

      initialRequest.sendRequest(initialMessage, new RequestCallback() {
        @Override
        public void onResponseReceived(Request request, Response response) {
          try {
            LogUtil.log("received response from initial handshake.");
            procIncomingPayload(response);
View Full Code Here

      }
    }
  }

  protected void requestData() {
    RequestBuilder rb = requestBuilder == null ? new RequestBuilder(httpMethod, url) : requestBuilder;

    if (callback == null) {
      callback = new RequestCallback() {
        public void onError(Request request, Throwable exception) {
          handleError(request, exception);
        }

        public void onResponseReceived(Request request, Response response) {
          handleResponseReceived(request, response);
        }
      };
    }
    try {
      rb.sendRequest(requestData, callback);
    } catch (RequestException e) {
      handleError(null, e);
    }
  }
View Full Code Here

    listTable.getRowFormatter().setVerticalAlign(row,HasVerticalAlignment.ALIGN_TOP);
    final Image icon = new Image("icon_user.gif");
    icon.addClickListener(new ClickListener(){
      public void onClick( Widget sender ){
        try{
        RequestBuilder requestBuilder = new RequestBuilder( RequestBuilder.GET, GWT.getModuleBaseURL()+"/"+client.getName()+".html" );
        requestBuilder.sendRequest( null, new RequestCallback(){
          public void onError(Request request, Throwable exception){ /*ignored*/ }
          public void onResponseReceived(Request request, Response response){
            if( response.getStatusCode() == 200 ){
              PopupPanel popup = new PopupPanel(true);
              popup.setStyleName("popup");
View Full Code Here

    htmlPanel.getElement().setInnerHTML("");
  }

  private void showUrl(String url) {
    clear();
    RequestBuilder requestBuilder = new RequestBuilder(RequestBuilder.GET, url);

    requestBuilder.setCallback(new RequestCallback() {

      @Override
      public void onResponseReceived(Request request, Response response) {
        show(response.getText());
      }

      @Override
      public void onError(Request request, Throwable ex) {
        Window.alert(ex.getMessage());
      }
    });
    try {
      requestBuilder.send();
    } catch (RequestException ex) {
      Window.alert(ex.getMessage());
    }
  }
View Full Code Here

TOP

Related Classes of com.google.gwt.http.client.RequestBuilder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.