Creates a new result with the status {@literal 401 - UNAUTHORIZED} with the given content. The result has the
{@literal Content-Type} header set to {@literal text/plain}.

@param content the content
@return a new configured result
338911
public static Result unauthorized(String content) {
        return status(Result.UNAUTHORIZED).render(content).as(MimeTypes.TEXT);
    }
119726
public byte[] generateSignature(@NonNull byte[] content) {
        try {
            Mac mac = Mac.getInstance(HASH_ALGORITHM);
            mac.init(secretKeySpec);
            return mac.doFinal(content);
        } catch (NoSuchAlgorithmException | InvalidKeyException e) {
            // "HmacSHA256" is always supported in Java 8 platform.
            //   (see https://docs.oracle.com/javase/8/docs/api/javax/crypto/Mac.html)
            // All valid-SecretKeySpec-instance are not InvalidKey.
            //   (because the key for HmacSHA256 can be of any length. see RFC2104)
            throw new IllegalStateException(e);
        }
    }
630559
public void addContent(Content content) {
    Content newContent = new Content();
    newContent.setType(content.getType());
    newContent.setValue(content.getValue());
    this.content = addToList(newContent, this.content);
  }
975335
public static String sign(PrivateKey key, String content) throws Exception {
        Signature signature = Signature.getInstance(SIGN_ALGORITHM);
        signature.initSign(key);
        signature.update(content.getBytes());
        return Base64.encodeBase64String(signature.sign());
    }
995303
private String transformContent(String content) {

        try {
            List<CmsJsonPart> parts = CmsJsonPart.parseJsonParts(content);
            JSONArray keys = new JSONArray();
            JSONObject output = new JSONObject();
            for (CmsJsonPart part : parts) {
                if (output.has(part.getKey())) {
                    LOG.warn("Duplicate key for JSON parts: " + part.getKey());
                }
                keys.put(part.getKey());
                output.put(part.getKey(), part.getValue());
            }
            output.put(KEY_PARTS, keys);
            return output.toString();
        } catch (Exception e) {
            LOG.error(e.getLocalizedMessage(), e);
            return content;

        }
    }
44108
public static Config fromYAML(String content) throws IOException {
        ConfigSupport support = new ConfigSupport();
        return support.fromYAML(content, Config.class);
    }
67354
public final Post withContent(final String content) {
      return new Post(id, slug, title, excerpt, content, authorId, author,
              publishTimestamp, modifiedTimestamp, status, parentId,
              guid, commentCount, metadata, type, mimeType, taxonomyTerms, children);
   }
630385
public HttpRequest withBody(byte[] content) {
        headers.set("Content-Length", String.valueOf(content.length));
        // Unpooled.wrappedBuffer(body) allocates ByteBuf from unpooled heap
        return withBody(Flux.defer(() -> Flux.just(Unpooled.wrappedBuffer(content))));
    }
615848
public static function create(
        $content,
        $content_type = null,
        $status = ServiceResponseInterface::HTTP_OK,
        $headers = []
    ) {
        return new ServiceResponse($content, $content_type, $status, $headers);
    }
716956
public HttpRequestBuilder withContent(String type, String content) {
    return withContent(type, content.getBytes(StandardCharsets.UTF_8));
  }
431170
@Override
    public boolean save(String content, String location) {
        return save(content, Charsets.UTF_8, location);
    }
691296
public static UniversalIdIntMessage newInstance(Long id, byte[] content) {
        UniversalIdIntMessage msg = newInstance(content);
        msg.setId(id);
        return msg;
    }
1219351
public Document createRaw(@NonNull String id, @NonNull String content) {
      return createRaw(id, content, defaultLanguage, Collections.emptyMap());
   }
605153
public static String decode(String content, Charset charset) {
		if (null == charset) {
			charset = CharsetUtil.defaultCharset();
		}
		return decode(content, charset.name());
	}
806486
@Override
	protected boolean copyRequestedContentToResponse(String requestedPath, HttpServletResponse response,
			String contentType) throws IOException {

		boolean copyDone = false;
		if (isValidRequestedPath(requestedPath)) {

			try {
				writeContent(requestedPath, null, response);
				response.setContentType(contentType);
				copyDone = true;
			} catch (ResourceNotFoundException e) {
				// Nothing to do here
			}
		}

		return copyDone;
	}
741238
public static String encryptContent(String content, String encryptType, String encryptKey,
                                        String charset) throws AlipayApiException {

        if (AES_ALG.equals(encryptType)) {

            return aesEncrypt(content, encryptKey, charset);

        } else {

            throw new AlipayApiException("当前不支持该算法类型：encrypeType=" + encryptType);
        }

    }
465650
public static JsonDoubleDocument create(String id, Double content) {
        return new JsonDoubleDocument(id, 0, content, 0, null);
    }