Package com.google.gwt.http.client

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


  }

  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

  }

  private RequestBuilder getSendBuilder() {
    final String endpoint = OUT_SERVICE_ENTRY_POINT;

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

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

    return builder;
  }
View Full Code Here

  }

  private RequestBuilder getRecvBuilder() {
    final String endpoint = IN_SERVICE_ENTRY_POINT;

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

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

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

      final 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

  public String getRequestUrl() {
    return requestUrl;
  }

  public void send(String payload, TransportReceiver receiver) {
    RequestBuilder builder = createRequestBuilder();
    configureRequestBuilder(builder);

    builder.setRequestData(payload);
    builder.setCallback(createRequestCallback(receiver));

    try {
      wireLogger.finest("Sending fire request");
      builder.send();
    } catch (RequestException e) {
      wireLogger.log(Level.SEVERE, SERVER_ERROR + " (" + e.getMessage() + ")",
          e);
    }
  }
View Full Code Here

   * method sent to the URL returned from {@link #getRequestUrl()}.
   *
   * @return a {@link RequestBuilder} instance
   */
  protected RequestBuilder createRequestBuilder() {
    return new RequestBuilder(RequestBuilder.POST, getRequestUrl());
  }
View Full Code Here

        return instance;
    }

    public void showHomePage()
    {
        RequestBuilder builder = new RequestBuilder(RequestBuilder.GET,
                "home.jsp");
        builder.setCallback(new RequestCallback() {

            public void onError(Request request, Throwable exception)
            {
                Window.alert("An error occured while requesting the home page" +
                    " from the server. " + exception.getMessage());               
            }

            public void onResponseReceived(Request request, Response response)
            {
                HTMLPanel p = new HTMLPanel(response.getText());
                p.setStyleName("jiplet-Form");
                setCurrentPanel(p);
               
            }});

        try
        {
            builder.send();
        }
        catch (RequestException e)
        {
            Window.alert("An error occured while requesting the home page" +
                    " from the server. " + e.getMessage());
View Full Code Here

   * @param levels The depth that the graph should be drawn to, only valid
   * if the XML represents a new graph.
   */
  public static void request(String url, final int levels){
     
      RequestBuilder requestBuilder = new RequestBuilder(RequestBuilder.GET, url);
      try {
        requestBuilder.sendRequest(null, new RequestCallback() {
          /* (non-Javadoc)
           * @see com.google.gwt.http.client.RequestCallback#onError(com.google.gwt.http.client.Request, java.lang.Throwable)
           */
          public void onError(Request request, Throwable exception) {
            Home.webError("Error: " + exception);
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.