Examples of ResponseModel


Examples of com.amazonaws.resources.internal.model.ResponseModel

        this.nextTokenPath = nextTokenPath;
    }

    @Override
    public ResponseModel build() {
        return new ResponseModel(resourceMapping, dataMapping, nextTokenPath);
    }
View Full Code Here

Examples of com.amazonaws.resources.internal.model.ResponseModel

                extractor.setResponseMetadata(responseMetadata);
                extractor.setClientResult(clientResult);
            }

            ResponseModel responseModel = action.getResponse();

            Object data = null;
            List<ResourceImpl> resources = null;
            Object nextToken = null;

            if (responseModel != null) {
                if (responseModel.getDataMapping() != null) {
                    data = getResultAttributes(
                        responseModel.getDataMapping().getSource(),
                        clientResult);

                } else if (responseModel.getResourceMapping() != null) {
                    resources = getResultResources(
                        context,
                        responseModel.getResourceMapping(),
                        request,
                        clientResult);

                } else {
                    data = clientResult;
                }

                if (responseModel.getNextTokenPath() != null) {
                    nextToken = ReflectionUtils.getByPath(
                        clientResult, responseModel.getNextTokenPath());
                }
            }

            return new ActionResult(data, resources, nextToken);
View Full Code Here

Examples of edu.wpi.cs.wpisuitetng.network.models.ResponseModel

  public void responseSuccess(IRequest iReq) {
    // cast observable to request
    Request request = (Request) iReq;

    // get the response from the request
    ResponseModel response = request.getResponse();

    if (response.getStatusCode() == 200) {
      // parse the response       
      Defect[] defects = Defect.fromJSONArray(response.getBody());

      // notify the controller
      controller.receivedData(defects);
    }
    else {
View Full Code Here

Examples of edu.wpi.cs.wpisuitetng.network.models.ResponseModel

  public void responseSuccess(IRequest iReq) {
    // cast observable to a Request
    Request request = (Request) iReq;

    // get the response from the request
    ResponseModel response = request.getResponse();

    // check the response code of the request
    if (response.getStatusCode() != 200) {
      controller.errorRetrievingDefect("Received " + iReq.getResponse().getStatusCode() + " error from server: " + iReq.getResponse().getStatusMessage());
      return;
    }

    // parse the defect received from the core
    Defect[] defects = Defect.fromJSONArray(response.getBody());
    if (defects.length > 0 && defects[0] != null) {
      controller.showDefect(defects[0]);
    }
    else {
      controller.errorRetrievingDefect("No defects received.");
View Full Code Here

Examples of edu.wpi.cs.wpisuitetng.network.models.ResponseModel

  public void responseSuccess(IRequest iReq) {
    // cast observable to a Request
    Request request = (Request) iReq;

    // get the response from the request
    ResponseModel response = request.getResponse();

    // check the response code of the request
    if (response.getStatusCode() != 200) {
      controller.requestFailed();
      return;
    }

    // parse the list of defects received from the core
    Defect[] defects = Defect.fromJSONArray(response.getBody());

    // make sure that there is actually a defect in the body     
    if (defects.length > 0 && defects[0] != null) {
      controller.receivedResponse(defects[0]);
    }
View Full Code Here

Examples of edu.wpi.cs.wpisuitetng.network.models.ResponseModel

          reader.close();
        }
      }
     
      // create Response
      ResponseModel response = new Response(responseCode, responseMessage, responseHeaders, responseBody);
     
      // set the Request's response to the newly created response
      request.setResponse(response);
    } catch (IOException e) {
      exceptionRecv = e;
View Full Code Here

Examples of edu.wpi.cs.wpisuitetng.network.models.ResponseModel

*/
public class MyRequestObserver implements RequestObserver {
  @Override
  public void responseSuccess(IRequest iReq) {
      // get the response from the request
      ResponseModel response = iReq.getResponse();

      // print the body
      System.out.println("Received response: " + response.getBody());

  }
View Full Code Here

Examples of edu.wpi.cs.wpisuitetng.network.models.ResponseModel

  private class Handler implements Container {
    private RequestModel lastReceived;
    private ResponseModel cannedResponse;
   
    public Handler() {
      cannedResponse = new ResponseModel();
      cannedResponse.setStatusCode(200);
      cannedResponse.setStatusMessage("OK");
      cannedResponse.setBody("");
    }
View Full Code Here

Examples of edu.wpi.cs.wpisuitetng.network.models.ResponseModel

   * @see edu.wpi.cs.wpisuitetng.network.RequestObserver#responseSuccess(edu.wpi.cs.wpisuitetng.network.models.IRequest)
   */
  @Override
  public void responseSuccess(IRequest iReq) {
    // Get the response to the given request
    final ResponseModel response = iReq.getResponse();
   
    // Parse the message out of the response body
    final PostBoardMessage message = PostBoardMessage.fromJson(response.getBody());
   
    // Pass the messages back to the controller
    controller.addMessageToModel(message);
  }
View Full Code Here

Examples of edu.wpi.cs.wpisuitetng.network.models.ResponseModel

  public void responseSuccess(IRequest iReq) {
    // cast observable to a Request
    Request request = (Request) iReq;

    // get the response from the request
    ResponseModel response = request.getResponse();

    // print the body
    System.out.println("Received response: " + response.getBody()); //TODO change this to logger
    if (response.getStatusCode() == 200) {
      // parse the defect from the body
      final Defect defect = Defect.fromJSON(response.getBody());

      // make sure the defect isn't null
      if (defect != null) {
        SwingUtilities.invokeLater(new Runnable() {
          @Override
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.