Package com.perceptus.supers3t

Examples of com.perceptus.supers3t.S3ClientRequest


        // Things we need from the response
        final AtomicInteger responseCode = new AtomicInteger();

        final Buffer toUpload = new Buffer(new byte[expectedLength]);
        synchronized (responseCode) {
            S3ClientRequest request = client.createPutRequest(testBucket,
                                                              "testObject",
                                                              new Handler<HttpClientResponse>() {
                                                                  @Override public void
                                                                          handle(HttpClientResponse event) {
                                                                      logger.info("Response message: "
                                                                                  + event.statusMessage);

                                                                      synchronized (responseCode) {
                                                                          responseCode.set(event.statusCode);
                                                                          responseCode.notify();
                                                                      }
                                                                  }
                                                              });
            request.end(toUpload);
            try {
                responseCode.wait(10000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
View Full Code Here


        // Things we need from the response
        final Buffer responseBody = new Buffer();
        final AtomicInteger responseCode = new AtomicInteger();

        synchronized (responseBody) {
            S3ClientRequest request = client.createGetRequest(testBucket,
                                                              "testObject",
                                                              new Handler<HttpClientResponse>() {

                                                                  @Override public void
                                                                          handle(HttpClientResponse event) {
                                                                      responseCode.set(event.statusCode);
                                                                      if (event.statusCode != 200) {
                                                                          synchronized (responseBody) {
                                                                              // This
                                                                              // is
                                                                              // a
                                                                              // failed
                                                                              // request
                                                                              logger.error("Bad response: "
                                                                                           + event.statusCode);
                                                                              responseBody.notify();
                                                                          }
                                                                          return;
                                                                      }

                                                                      // Try to
                                                                      // download
                                                                      // the
                                                                      // body
                                                                      event.bodyHandler(new Handler<Buffer>() {
                                                                          @Override public void
                                                                                  handle(Buffer event) {
                                                                              // Append
                                                                              // the
                                                                              // body
                                                                              // on
                                                                              synchronized (responseBody) {
                                                                                  logger.info("Got body: "
                                                                                              + event.length()
                                                                                              + "bytes");
                                                                                  responseBody.appendBuffer(event);
                                                                                  responseBody.notify();
                                                                              }
                                                                          }
                                                                      });
                                                                  }
                                                              });
            request.end();
            try {
                responseBody.wait(10000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
View Full Code Here

        // Things we need from the response
        final AtomicInteger responseCode = new AtomicInteger();

        synchronized (responseCode) {
            S3ClientRequest request = client.createDeleteRequest(testBucket,
                                                                 "testObject",
                                                                 new Handler<HttpClientResponse>() {
                                                                     @Override public void
                                                                             handle(HttpClientResponse event) {
                                                                         synchronized (responseCode) {
                                                                             responseCode.set(event.statusCode);
                                                                             responseCode.notify();
                                                                         }
                                                                     }
                                                                 });
            request.end();

            try {
                responseCode.wait(10000);
            } catch (InterruptedException e) {
                e.printStackTrace();
View Full Code Here

TOP

Related Classes of com.perceptus.supers3t.S3ClientRequest

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.