Set the response content. To return an empty response pass in a new empty
array, but not <code>null</code>.

@param aContent
The content to be returned. Is <b>not</b> copied inside! May not be
<code>null</code> but maybe empty.
@return this
491113
@Nonnull
  public final UnifiedResponse setContent (@Nonnull final byte [] aContent)
  {
    ValueEnforcer.notNull (aContent, "Content");
    return setContent (aContent, 0, aContent.length);
  }
253424
protected void setSOAPResponseObject(SOAPMessageContext context,
                                         Object newResponse) {
        if (newResponse == null) {
            return;
        }
        // Extract the SOAP Message
        SOAPMessage message = context.getMessage();

        // Get the envelope body
        SOAPElement body;
        try {
            body = message.getSOAPBody();
            SOAPElement response = getSOAPResponseNode(context);
            body.removeChild(response);
            marshall(newResponse, body);
        } catch (SOAPException e) {
            logger.error("Problem changing SOAP message contents", e);
            throw CXFUtility.getFault(e);
        }
    }
1269246
public function setContents(array $aContents) {
		$this->aContents = array();
		foreach ($aContents as $content) {
			$this->append($content);
		}
	}
103321
public void setContent(final byte[] content,
                         final String contentType) throws HttpException {
    if (!(method instanceof HttpEntityEnclosingRequestBase)) {
      throw new HttpException("Invalid operation for method " +
                               method.getMethod());
    }

    final HttpEntityEnclosingRequestBase eem = (HttpEntityEnclosingRequestBase)method;

    ByteArrayEntity entity = new ByteArrayEntity(content);
    entity.setContentType(contentType);
    eem.setEntity(entity);
  }
890633
public void setContentEncoding(String contentEncoding) throws InvalidArgumentException {
    if (Strings.isNullOrEmpty(contentEncoding)) {
      throw new InvalidArgumentException("empty content encoding");
    }

    this.contentEncoding = contentEncoding;
  }
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;
    }
1200028
public final void setContent(byte[] content)
    {
        //clear non relevant flags
        this.contentString=null;
        this.contentParts=null;
        this.contentType=ContentType.BINARY;

        if(content==null)
        {
            this.contentBinary=null;
        }
        else
        {
            this.contentBinary=content.clone();
        }
    }
18450
@JsonIgnore
    public void encodeAndSetContent(String content) {
        encodeAndSetContent(content != null ? content.getBytes() : null);
    }
930266
public void setContent(IContent content)
	{
		this.content = content;
		content.setParent(this);
		content.setPosition(Position.middleCenter(content));
		contentSize = content.size().plus(Size.of(6, 6));
	}
622124
private Response copyContent(String spaceID,
                                 String contentID,
                                 String storeID,
                                 String sourceStoreID,
                                 String copySource) {
        StringBuilder msg = new StringBuilder("copying content from (");
        msg.append(copySource);
        msg.append(") to (");
        msg.append(spaceID);
        msg.append(" / ");
        msg.append(contentID);
        msg.append(", ");
        msg.append(storeID);
        msg.append(")");
        log.info(msg.toString());

        try {
            return doCopyContent(spaceID, contentID, storeID, sourceStoreID, copySource);

        } catch (InvalidIdException e) {
            return responseBad(msg.toString(), e, BAD_REQUEST);

        } catch (InvalidRequestException e) {
            return responseBad(msg.toString(), e, BAD_REQUEST);

        } catch (ResourceNotFoundException e) {
            return responseNotFound(msg.toString(), e, NOT_FOUND);

        } catch (ResourceStateException e) {
            return responseBad(msg.toString(), e, CONFLICT);

        } catch (ResourceException e) {
            return responseBad(msg.toString(), e, INTERNAL_SERVER_ERROR);

        } catch (Exception e) {
            return responseBad(msg.toString(), e, INTERNAL_SERVER_ERROR);
        }
    }
1261046
public function setContent($content)
    {
        if (null !== $content && !is_string($content) && !is_numeric($content) &&
            ! is_callable(array($content, '__toString'))) {
            throw new \Exception(sprintf(
                'The Response content must be a string or object implementing __toString(), "%s" given.',
                gettype($content)
            ));
        }

        $this->content = $content;

        return $this;
    }
254575
public function setContent($content)
    {
        if (is_null($this->mbRequest)) {
            return $this;
        }

        $this->prepare($this->mbRequest);

        if ($this->mbRequest->isMethod("GET") || $this->mbRequest->isMethod("DELETE")) {
            $this->statusCode = BaseResponse::HTTP_OK;
        } elseif ($this->mbRequest->isMethod("POST") || $this->mbRequest->isMethod("PUT")) {
            $this->statusCode = BaseResponse::HTTP_CREATED;
        } else {
            $this->statusCode = BaseResponse::HTTP_RESET_CONTENT;
        }

        if ($content instanceof \Exception) {
            $this->statusCode = $content->getCode();
            $this->statusCode = $this->isSuccessful() ? $this->statusCode : BaseResponse::HTTP_BAD_REQUEST;
        }

        if($this->isBuffer()){
            $this->original = $content;
        } elseif ($this->mbRequest->isAjax()) {
            $this->ajaxContent($content);
        } else {
            $this->htmlContent($content);
        }

        return $this;
    }
52245
public Article addMediaContent(MediaContent mediaContent) {
		if(mediaContent == null)
			return this;

		if(this.mediaContentVec == null)
			this.mediaContentVec = new Vector<>();

		this.mediaContentVec.add(mediaContent);

		return this;
	}
996104
public ParallelTaskBuilder setResponseContext(
            Map<String, Object> responseContext) {
        if (responseContext != null)
            this.responseContext = responseContext;
        else
            logger.error("context cannot be null. skip set.");
        return this;
    }
1278038
public function setContent(AbstractClassContent $content = null)
    {
        $this->_content = $content;

        if (null !== $this->_content) {
            $this->setClassname(ClassUtils::getRealClass($this->_content));
        }

        return $this->getContentInstance();
    }
790842
protected void setContentEnd(String contentEnd) {
        if (contentEnd == null) {
            contentEnd = StringUtils.EMPTY;
        }
        this.contentEnd = contentEnd;
    }
1013611
public final void setContent(String content)
    {
        //clear non relevant flags
        this.contentBinary=null;
        this.contentParts=null;
        this.contentType=ContentType.STRING;

        this.contentString=content;
    }