Examples of payload()


Examples of org.elasticsearch.common.xcontent.XContentBuilder.payload()

                byte[] body = new byte[response.contentLength()];
                System.arraycopy(response.content(), 0, body, 0, response.contentLength());
                tResponse.setBody(ByteBuffer.wrap(body));
                if (response instanceof XContentRestResponse) {
                    XContentBuilder builder = ((XContentRestResponse) response).builder();
                    if (builder.payload() instanceof CachedStreamOutput.Entry) {
                        CachedStreamOutput.pushEntry((CachedStreamOutput.Entry) builder.payload());
                    }
                }
            }
        }
View Full Code Here

Examples of org.elasticsearch.common.xcontent.XContentBuilder.payload()

                System.arraycopy(response.content(), 0, body, 0, response.contentLength());
                tResponse.setBody(ByteBuffer.wrap(body));
                if (response instanceof XContentRestResponse) {
                    XContentBuilder builder = ((XContentRestResponse) response).builder();
                    if (builder.payload() instanceof CachedStreamOutput.Entry) {
                        CachedStreamOutput.pushEntry((CachedStreamOutput.Entry) builder.payload());
                    }
                }
            }
        }
        return tResponse;
View Full Code Here

Examples of org.elasticsearch.common.xcontent.XContentBuilder.payload()

        try {
            if (response instanceof XContentRestResponse) {
                // if its a builder based response, and it was created with a CachedStreamOutput, we can release it
                // after we write the response, and no need to do an extra copy because its not thread safe
                XContentBuilder builder = ((XContentRestResponse) response).builder();
                if (builder.payload() instanceof CachedStreamOutput.Entry) {
                    releaseContentListener = new NettyTransport.CacheFutureListener((CachedStreamOutput.Entry) builder.payload());
                    buf = ChannelBuffers.wrappedBuffer(builder.unsafeBytes(), 0, builder.unsafeBytesLength());
                } else if (response.contentThreadSafe()) {
                    buf = ChannelBuffers.wrappedBuffer(response.content(), 0, response.contentLength());
                } else {
View Full Code Here

Examples of org.elasticsearch.common.xcontent.XContentBuilder.payload()

            if (response instanceof XContentRestResponse) {
                // if its a builder based response, and it was created with a CachedStreamOutput, we can release it
                // after we write the response, and no need to do an extra copy because its not thread safe
                XContentBuilder builder = ((XContentRestResponse) response).builder();
                if (builder.payload() instanceof CachedStreamOutput.Entry) {
                    releaseContentListener = new NettyTransport.CacheFutureListener((CachedStreamOutput.Entry) builder.payload());
                    buf = ChannelBuffers.wrappedBuffer(builder.unsafeBytes(), 0, builder.unsafeBytesLength());
                } else if (response.contentThreadSafe()) {
                    buf = ChannelBuffers.wrappedBuffer(response.content(), 0, response.contentLength());
                } else {
                    buf = ChannelBuffers.copiedBuffer(response.content(), 0, response.contentLength());
View Full Code Here

Examples of org.fusesource.mqtt.codec.PUBLISH.payload()

        if (message.getDataStructureType() == ActiveMQTextMessage.DATA_STRUCTURE_TYPE) {
            ActiveMQTextMessage msg = (ActiveMQTextMessage) message.copy();
            msg.setReadOnlyBody(true);
            String messageText = msg.getText();
            if (messageText != null) {
                result.payload(new Buffer(messageText.getBytes("UTF-8")));
            }
        } else if (message.getDataStructureType() == ActiveMQBytesMessage.DATA_STRUCTURE_TYPE) {
            ActiveMQBytesMessage msg = (ActiveMQBytesMessage) message.copy();
            msg.setReadOnlyBody(true);
            byte[] data = new byte[(int) msg.getBodyLength()];
View Full Code Here

Examples of org.jclouds.blobstore.domain.BlobBuilder.payload()

   protected Object doExecute() throws Exception {
      BlobStore blobStore = getBlobStore();

      BlobBuilder builder = blobStore.blobBuilder(blobName);
      if (stringPayload) {
         builder = builder.payload(payload.getBytes())// use default Charset
      } else if (urlPayload) {
         InputStream input = new URL(payload).openStream();
         try {
            builder = builder.payload(ByteStreams.toByteArray(input));
         } finally {
View Full Code Here

Examples of org.jclouds.blobstore.domain.BlobBuilder.payload()

      if (stringPayload) {
         builder = builder.payload(payload.getBytes())// use default Charset
      } else if (urlPayload) {
         InputStream input = new URL(payload).openStream();
         try {
            builder = builder.payload(ByteStreams.toByteArray(input));
         } finally {
            input.close();
         }
      } else {
         ByteSource byteSource = Files.asByteSource(new File(payload));
View Full Code Here

Examples of org.jclouds.blobstore.domain.BlobBuilder.payload()

         } finally {
            input.close();
         }
      } else {
         ByteSource byteSource = Files.asByteSource(new File(payload));
         BlobBuilder.PayloadBlobBuilder payloadBuilder = builder
               .payload(byteSource)
               .contentLength(byteSource.size());
         if (!multipartUpload) {
            payloadBuilder = payloadBuilder.contentMD5(byteSource.hash(Hashing.md5()).asBytes());
         }
View Full Code Here

Examples of org.jclouds.openstack.swift.v1.domain.SwiftObject.payload()

         assertNotNull(etagOfEtags);

         SwiftObject bigObject = api.objectApiInRegionForContainer(regionId, containerName).head(name);
         assertNotEquals(bigObject.etag(), etagOfEtags);
         assertEquals(bigObject.payload().getContentMetadata().getContentLength(), new Long(2 * 1024 * 1024));
         assertEquals(bigObject.metadata(), ImmutableMap.of("myfoo", "Bar"));

         // segments are visible
         assertEquals(api.containerApiInRegion(regionId).get(containerName).objectCount(), 3);
      }
View Full Code Here

Examples of org.jclouds.openstack.swift.v1.domain.SwiftObject.payload()

   }

   protected void assertMegabyteAndETagMatches(String regionId, String name, String etag1s) {
      SwiftObject object1s = api.objectApiInRegionForContainer(regionId, containerName).head(name);
      assertEquals(object1s.etag(), etag1s);
      assertEquals(object1s.payload().getContentMetadata().getContentLength(), new Long(1024 * 1024));
   }
}
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.