Package edu.wpi.cs.wpisuitetng.network

Examples of edu.wpi.cs.wpisuitetng.network.Request.send()


  public void refreshData() {   
    final RequestObserver requestObserver = new RetrieveAllDefectsRequestObserver(this);
    Request request;
    request = Network.getInstance().makeRequest("defecttracker/defect", HttpMethod.GET);
    request.addObserver(requestObserver);
    request.send();
  }

  /**
   * This method is called by the {@link RetrieveAllDefectsRequestObserver} when the
   * response is received
View Full Code Here


      // Generate the request
      Request request;
      request = Network.getInstance().makeRequest("defecttracker/defect/" + id, HttpMethod.GET);
      request.addObserver(new LookupRequestObserver(this));
      request.send();
    }
  }

  /**
   * Method called by the observer when the response is received
View Full Code Here

        // Create and send a request for the defect with the given ID
        Request request;
        request = Network.getInstance().makeRequest("defecttracker/defect/" + defectId, HttpMethod.GET);
        request.addObserver(new RetrieveDefectRequestObserver(this));
        request.send();
      }
    }
  }

  /**
 
View Full Code Here

    Request request;
    panel.getParent().setInputEnabled(false);
    request = Network.getInstance().makeRequest("defecttracker/defect", (panel.getEditMode() == Mode.CREATE) ? HttpMethod.PUT : HttpMethod.POST);
    request.setBody(panel.getEditedModel().toJSON());
    request.addObserver(requestObserver);
    request.send();
  }

}
View Full Code Here

          "defecttracker/comment", HttpMethod.PUT);
      final Comment comment = new Comment(model.getId(), model.getCreator(), view.getCommentField().getText());
      view.getCommentField().setText("");
      request.setBody(comment.toJSON());
      request.addObserver(requestObserver);
      request.send();
    }
  }
 
  /**
   * Add the comment to the view if the server responded with a success message
View Full Code Here

    // Configure the request
    manualRequest.setBody(body1)// set the request body to send to the server
    manualRequest.addObserver(requestObserver)// Add the requestObserver to the request's set of Observers

    // Send the request!
    manualRequest.send();

    // This should print first.
    System.out.println("This was printed after sending the manually created Request!");

View Full Code Here

    // Configure the request
    networkRequest.setBody(body2)// set the request body to send to the server
    networkRequest.addObserver(requestObserver)// Add the requestObserver to the request's set of Observers

    // Send the request!
    networkRequest.send();

    // This should print first.
    System.out.println("This was printed after sending the Request created using Network!");
  }
}
View Full Code Here

     
      // Send a request to the core to save this message
      final Request request = Network.getInstance().makeRequest("postboard/postboardmessage", HttpMethod.PUT); // PUT == create
      request.setBody(new PostBoardMessage(message).toJSON()); // put the new message in the body of the request
      request.addObserver(new AddMessageRequestObserver(this)); // add an observer to process the response
      request.send(); // send the request
    }
  }

  /**
   * When the new message is received back from the server, add it to the local model.
View Full Code Here

  @Override
  public void actionPerformed(ActionEvent e) {
    // Send a request to the core to save this message
    final Request request = Network.getInstance().makeRequest("postboard/postboardmessage", HttpMethod.GET); // GET == read
    request.addObserver(new GetMessagesRequestObserver(this)); // add an observer to process the response
    request.send(); // send the request
  }
 
  /**
   * Add the given messages to the local model (they were received from the core).
   * This method is called by the GetMessagesRequestObserver
View Full Code Here

      // Configure the request
      manualRequest.setBody(body)// set the request body to send to the server
      manualRequest.addObserver(requestObserver)// Add the requestObserver to the request's set of Observers

      // Send the request!
      manualRequest.send();
      synchronized (requestObserver) {
        requestObserver.wait(2000);
      }

      //assertEquals(true, (body+"\n").equals(manualRequest.getResponse().getBody()));
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.