コード例 #1
0
  public GetJobOutputResult unmarshall(JsonUnmarshallerContext context) throws Exception {
    GetJobOutputResult getJobOutputResult = new GetJobOutputResult();

    if (context.isStartOfDocument()) {
      if (context.getHeader("x-amz-sha256-tree-hash") != null)
        getJobOutputResult.setChecksum(context.getHeader("x-amz-sha256-tree-hash"));
      if (context.getHeader("Content-Range") != null)
        getJobOutputResult.setContentRange(context.getHeader("Content-Range"));
      if (context.getHeader("Accept-Ranges") != null)
        getJobOutputResult.setAcceptRanges(context.getHeader("Accept-Ranges"));
      if (context.getHeader("Content-Type") != null)
        getJobOutputResult.setContentType(context.getHeader("Content-Type"));
      if (context.getHeader("x-amz-archive-description") != null)
        getJobOutputResult.setArchiveDescription(context.getHeader("x-amz-archive-description"));
    }

    getJobOutputResult.setStatus(context.getHttpResponse().getStatusCode());
    getJobOutputResult.setBody(
        new LengthCheckInputStream(
            context.getHttpResponse().getContent(),
            Long.parseLong(context.getHeader("Content-Length")),
            INCLUDE_SKIPPED_BYTES));

    return getJobOutputResult;
  }
  public CompleteMultipartUploadResult unmarshall(JsonUnmarshallerContext context)
      throws Exception {
    CompleteMultipartUploadResult completeMultipartUploadResult =
        new CompleteMultipartUploadResult();

    if (context.isStartOfDocument()) {
      if (context.getHeader("Location") != null) {
        context.setCurrentHeader("Location");
        completeMultipartUploadResult.setLocation(
            StringJsonUnmarshaller.getInstance().unmarshall(context));
      }

      if (context.getHeader("x-amz-sha256-tree-hash") != null) {
        context.setCurrentHeader("x-amz-sha256-tree-hash");
        completeMultipartUploadResult.setChecksum(
            StringJsonUnmarshaller.getInstance().unmarshall(context));
      }

      if (context.getHeader("x-amz-archive-id") != null) {
        context.setCurrentHeader("x-amz-archive-id");
        completeMultipartUploadResult.setArchiveId(
            StringJsonUnmarshaller.getInstance().unmarshall(context));
      }
    }

    return completeMultipartUploadResult;
  }
コード例 #3
0
  public CreateVaultResult unmarshall(JsonUnmarshallerContext context) throws Exception {
    CreateVaultResult createVaultResult = new CreateVaultResult();

    if (context.isStartOfDocument()) {
      if (context.getHeader("Location") != null)
        createVaultResult.setLocation(context.getHeader("Location"));
    }

    return createVaultResult;
  }
  public InitiateJobResult unmarshall(JsonUnmarshallerContext context) throws Exception {
    InitiateJobResult initiateJobResult = new InitiateJobResult();

    if (context.isStartOfDocument()) {
      if (context.getHeader("Location") != null) {
        context.setCurrentHeader("Location");
        initiateJobResult.setLocation(context.getUnmarshaller(String.class).unmarshall(context));
      }
      if (context.getHeader("x-amz-job-id") != null) {
        context.setCurrentHeader("x-amz-job-id");
        initiateJobResult.setJobId(context.getUnmarshaller(String.class).unmarshall(context));
      }
    }

    return initiateJobResult;
  }