Create a pre-defined payload with a content-available property set to 1.

@return a ready-to-send newsstand payload
967973
public static NewsstandNotificationPayload contentAvailable() {
		NewsstandNotificationPayload payload = complex();
		try {
			payload.addContentAvailable();
		} catch (JSONException e) {
		}
		return payload;
	}
247766
public <T extends PushConnector> FutureData<PushSubscription> create(final T connector,
                                                                         Stream stream,
                                                                         final String name,
                                                                         final Status initialStatus,
                                                                         final long start,
                                                                         final long end) {
        return create(connector, null, FutureData.wrap(stream), name, initialStatus, start, end);
    }
559420
static public ContentHandleFactory newFactory() {
    return new ContentHandleFactory() {
      @Override
      public Class<?>[] getHandledClasses() {
        return new Class<?>[]{ Source.class };
      }
      @Override
      public boolean isHandled(Class<?> type) {
        return Source.class.isAssignableFrom(type);
      }
      @Override
      public <C> ContentHandle<C> newHandle(Class<C> type) {
        @SuppressWarnings("unchecked")
        ContentHandle<C> handle = isHandled(type) ?
                                  (ContentHandle<C>) new SourceHandle() : null;
        return handle;
      }
    };
  }
566666
@Override
  public DocumentDescriptor create(DocumentUriTemplate template, W contentHandle)
    throws ForbiddenUserException, FailedRequestException {
    return create(template, null, contentHandle, null, null, null, null, null);
  }
681734
def broadcast(content)
      message = {
        id: SecureRandom.uuid,
        content: content
      }

      send_message('MSG_BROADCAST', message)
    end
988996
def payload(self):
        
        if self._content_type is not None:
            try:
                return self._payload[self._content_type]
            except KeyError:
                raise KeyError("Content-Type not available")
        else:

            if defines.Content_types["text/plain"] in self._payload:
                return self._payload[defines.Content_types["text/plain"]]
            else:
                val = list(self._payload.keys())
                return val[0], self._payload[val[0]]
1057130
static public ContentHandleFactory newFactory() {
    return new ContentHandleFactory() {
      @Override
      public Class<?>[] getHandledClasses() {
        return new Class<?>[]{ String.class };
      }
      @Override
      public boolean isHandled(Class<?> type) {
        return String.class.isAssignableFrom(type);
      }
      @Override
      public <C> ContentHandle<C> newHandle(Class<C> type) {
        @SuppressWarnings("unchecked")
        ContentHandle<C> handle = isHandled(type) ?
                                  (ContentHandle<C>) new StringHandle() : null;
        return handle;
      }
    };
  }
105133
protected SOAPMessage createSoapRequest(Object requestObj) throws ActivityException {
        try {
            MessageFactory messageFactory = getSoapMessageFactory();
            SOAPMessage soapMessage = messageFactory.createMessage();
            Map<Name,String> soapReqHeaders = getSoapRequestHeaders();
            if (soapReqHeaders != null) {
                SOAPHeader header = soapMessage.getSOAPHeader();
                for (Name name : soapReqHeaders.keySet()) {
                    header.addHeaderElement(name).setTextContent(soapReqHeaders.get(name));
                }
            }

            SOAPBody soapBody = soapMessage.getSOAPBody();

            Document requestDoc = null;
            if (requestObj instanceof String) {
                requestDoc = DomHelper.toDomDocument((String)requestObj);
            }
            else {
                Variable reqVar = getProcessDefinition().getVariable(getAttributeValue(REQUEST_VARIABLE));
                XmlDocumentTranslator docRefTrans = (XmlDocumentTranslator)VariableTranslator.getTranslator(getPackage(), reqVar.getType());
                requestDoc = docRefTrans.toDomDocument(requestObj);
            }

            SOAPBodyElement bodyElem = soapBody.addBodyElement(getOperation());
            String requestLabel = getRequestLabelPartName();
            if (requestLabel != null) {
                SOAPElement serviceNameElem = bodyElem.addChildElement(requestLabel);
                serviceNameElem.addTextNode(getRequestLabel());
            }
            SOAPElement requestDetailsElem = bodyElem.addChildElement(getRequestPartName());
            requestDetailsElem.addTextNode("<![CDATA[" + DomHelper.toXml(requestDoc) + "]]>");

            return soapMessage;
        }
        catch (Exception ex) {
            throw new ActivityException(ex.getMessage(), ex);
        }
    }
962570
@Override
    public HttpPostStandardRequestDecoder offer(HttpContent content) {
        checkDestroyed();

        // Maybe we should better not copy here for performance reasons but this will need
        // more care by the caller to release the content in a correct manner later
        // So maybe something to optimize on a later stage
        ByteBuf buf = content.content();
        if (undecodedChunk == null) {
            undecodedChunk = buf.copy();
        } else {
            undecodedChunk.writeBytes(buf);
        }
        if (content instanceof LastHttpContent) {
            isLastChunk = true;
        }
        parseBody();
        if (undecodedChunk != null && undecodedChunk.writerIndex() > discardThreshold) {
            undecodedChunk.discardReadBytes();
        }
        return this;
    }
880269
public byte[] getPayload(int payloadStart, int payloadSize) {
        byte[] payloadBuffer = new byte[payloadSize];
        System.arraycopy(currentBuffer, payloadStart, payloadBuffer, 0, payloadSize);
        return payloadBuffer;
    }
424556
def create_payload(self):
        
        payload = super(LifecycleEnvironment, self).create_payload()
        if (_get_version(self._server_config) < Version('6.1') and
                'prior_id' in payload):
            payload['prior'] = payload.pop('prior_id')
        return payload
1229729
@Override
    public InventoryMessage makeInventoryMessage(byte[] payloadBytes, int length) throws ProtocolException {
        return new InventoryMessage(params, payloadBytes, this, length);
    }
1224766
public static Payload create(String data) {
    return create(ByteBufUtil.writeUtf8(ByteBufAllocator.DEFAULT, data), null);
  }
223501
static public ContentHandleFactory newFactory() {
    return new ContentHandleFactory() {
      @Override
      public Class<?>[] getHandledClasses() {
        return new Class<?>[]{ Reader.class };
      }
      @Override
      public boolean isHandled(Class<?> type) {
        return Reader.class.isAssignableFrom(type);
      }
      @Override
      public <C> ContentHandle<C> newHandle(Class<C> type) {
        @SuppressWarnings("unchecked")
        ContentHandle<C> handle = isHandled(type) ?
                                  (ContentHandle<C>) new ReaderHandle() : null;
        return handle;
      }
    };
  }
1297196
public BodyContent push() {
	if (current.after == null) {
	    current.after = new Entry(current, new BodyContentImpl(current.body == null ? (JspWriter) base : current.body));
	}
	else {
	    current.after.doDevNull = false;
	    current.after.body.init(current.body == null ? (JspWriter) base : current.body);
	}
	current = current.after;
	return current.body;
    }
921937
public PayloadType<ConstraintType<T>> getOrCreatePayload()
   {
      Node node = childNode.getOrCreate("payload");
      PayloadType<ConstraintType<T>> payload = new PayloadTypeImpl<ConstraintType<T>>(this, "payload", childNode, node);
      return payload;
   }
923884
public Text getContentAsText() {
        if (contentType == ContentType.XML || 
            contentType == ContentType.JSON ||
            contentType == ContentType.TEXT) {
            return new Text(content);         
        }
        throw new UnsupportedOperationException(
        "Cannot convert binary data to Text.");
    }