org.jclouds.io.Payload.isSensitive()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(6.9k)|赞(0)|评价(0)|浏览(145)

本文整理了Java中org.jclouds.io.Payload.isSensitive()方法的一些代码示例,展示了Payload.isSensitive()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Payload.isSensitive()方法的具体详情如下:
包路径:org.jclouds.io.Payload
类名称:Payload
方法名:isSensitive

Payload.isSensitive介绍

[英]Returns whether the payload contains sensitive information. This is used when trying to decide whether to print out the payload information or not in logs
[中]返回有效负载是否包含敏感信息。当试图决定是否在日志中打印有效负载信息时,使用此选项

代码示例

代码示例来源:origin: Nextdoor/bender

public void input(PayloadEnclosing request) {
 Payload oldContent = request.getPayload();
 Payload wiredPayload;
 if (!oldContent.isSensitive() || isLogSensitiveInformation()) {
   wiredPayload = newPayload(input(oldContent.getInput()));
 } else {
   wiredPayload = newPayload(oldContent.getInput());
 }
 wiredPayload.setSensitive(oldContent.isSensitive());
 copyPayloadMetadata(oldContent, wiredPayload);
 request.setPayload(wiredPayload);
}

代码示例来源:origin: com.amysta.jclouds/jclouds-core

public void input(PayloadEnclosing request) {
 Payload oldContent = request.getPayload();
 Payload wiredPayload;
 if (!oldContent.isSensitive() || isLogSensitiveInformation()) {
   wiredPayload = newPayload(input(oldContent.getInput()));
 } else {
   wiredPayload = newPayload(oldContent.getInput());
 }
 wiredPayload.setSensitive(oldContent.isSensitive());
 copyPayloadMetadata(oldContent, wiredPayload);
 request.setPayload(wiredPayload);
}

代码示例来源:origin: apache/jclouds

public void input(PayloadEnclosing request) {
 Payload oldContent = request.getPayload();
 Payload wiredPayload;
 if (!oldContent.isSensitive() || isLogSensitiveInformation()) {
   wiredPayload = newPayload(input(oldContent.getInput()));
 } else {
   wiredPayload = newPayload(oldContent.getInput());
 }
 wiredPayload.setSensitive(oldContent.isSensitive());
 copyPayloadMetadata(oldContent, wiredPayload);
 request.setPayload(wiredPayload);
}

代码示例来源:origin: Nextdoor/bender

static String requestPayloadIfStringOrFormIfNotReturnEmptyString(HttpRequest request, boolean logSensitiveInformation) {
 Payload payload = request.getPayload();
 if (payload != null
    && ("application/x-www-form-urlencoded".equals(payload.getContentMetadata().getContentType()) || payload instanceof StringPayload)
    && payload.getContentMetadata().getContentLength() != null
    && payload.getContentMetadata().getContentLength() < 1024) {
   try {
    String logStatement;
    if (payload.isSensitive() && !logSensitiveInformation) {
      logStatement = "Sensitive data in payload, use " + Constants.PROPERTY_LOGGER_WIRE_LOG_SENSITIVE_INFO + " override to enable logging this data.";
    } else if (payload instanceof StringPayload) {
      logStatement = payload.getRawContent().toString();
    } else {
      logStatement = Strings2.toStringAndClose(payload.openStream());
    }
    return String.format(" [%s] ", logStatement);
   } catch (IOException e) {
   }
 }
 return "";
}

代码示例来源:origin: com.amysta.jclouds/jclouds-core

static String requestPayloadIfStringOrFormIfNotReturnEmptyString(HttpRequest request, boolean logSensitiveInformation) {
 Payload payload = request.getPayload();
 if (payload != null
    && ("application/x-www-form-urlencoded".equals(payload.getContentMetadata().getContentType()) || payload instanceof StringPayload)
    && payload.getContentMetadata().getContentLength() != null
    && payload.getContentMetadata().getContentLength() < 1024) {
   try {
    String logStatement;
    if (payload.isSensitive() && !logSensitiveInformation) {
      logStatement = "Sensitive data in payload, use " + Constants.PROPERTY_LOGGER_WIRE_LOG_SENSITIVE_INFO + " override to enable logging this data.";
    } else if (payload instanceof StringPayload) {
      logStatement = payload.getRawContent().toString();
    } else {
      logStatement = Strings2.toStringAndClose(payload.openStream());
    }
    return String.format(" [%s] ", logStatement);
   } catch (IOException e) {
   }
 }
 return "";
}

代码示例来源:origin: apache/jclouds

static String requestPayloadIfStringOrFormIfNotReturnEmptyString(HttpRequest request, boolean logSensitiveInformation) {
 Payload payload = request.getPayload();
 if (payload != null
    && ("application/x-www-form-urlencoded".equals(payload.getContentMetadata().getContentType()) || payload instanceof StringPayload)
    && payload.getContentMetadata().getContentLength() != null
    && payload.getContentMetadata().getContentLength() < 1024) {
   try {
    String logStatement;
    if (payload.isSensitive() && !logSensitiveInformation) {
      logStatement = "Sensitive data in payload, use " + Constants.PROPERTY_LOGGER_WIRE_LOG_SENSITIVE_INFO + " override to enable logging this data.";
    } else if (payload instanceof StringPayload) {
      logStatement = payload.getRawContent().toString();
    } else {
      logStatement = Strings2.toStringAndClose(payload.openStream());
    }
    return String.format(" [%s] ", logStatement);
   } catch (IOException e) {
   }
 }
 return "";
}

代码示例来源:origin: com.amysta.jclouds/jclouds-core

public void output(PayloadEnclosing request) {
 Payload oldContent = request.getPayload();
 Payload wiredPayload;
 if (!oldContent.isSensitive() || isLogSensitiveInformation()) {
   try {
    wiredPayload = newPayload(output(oldContent.getRawContent()));
   } catch (UnsupportedOperationException e) {
    wiredPayload = newPayload(output(oldContent.getInput()));
   }
 } else {
   try {
    wiredPayload = newPayload(oldContent.getRawContent());
   } catch (UnsupportedOperationException e) {
    wiredPayload = newPayload(oldContent.getInput());
   }
   output("Sensitive data in payload, use " + Constants.PROPERTY_LOGGER_WIRE_LOG_SENSITIVE_INFO + " override to enable logging this data.");
 }
 wiredPayload.setSensitive(oldContent.isSensitive());
 copyPayloadMetadata(oldContent, wiredPayload);
 request.setPayload(wiredPayload);
}

代码示例来源:origin: Nextdoor/bender

public void output(PayloadEnclosing request) {
 Payload oldContent = request.getPayload();
 Payload wiredPayload;
 if (!oldContent.isSensitive() || isLogSensitiveInformation()) {
   try {
    wiredPayload = newPayload(output(oldContent.getRawContent()));
   } catch (UnsupportedOperationException e) {
    wiredPayload = newPayload(output(oldContent.getInput()));
   }
 } else {
   try {
    wiredPayload = newPayload(oldContent.getRawContent());
   } catch (UnsupportedOperationException e) {
    wiredPayload = newPayload(oldContent.getInput());
   }
   output("Sensitive data in payload, use " + Constants.PROPERTY_LOGGER_WIRE_LOG_SENSITIVE_INFO + " override to enable logging this data.");
 }
 wiredPayload.setSensitive(oldContent.isSensitive());
 copyPayloadMetadata(oldContent, wiredPayload);
 request.setPayload(wiredPayload);
}

代码示例来源:origin: apache/jclouds

public void output(PayloadEnclosing request) {
 Payload oldContent = request.getPayload();
 Payload wiredPayload;
 if (!oldContent.isSensitive() || isLogSensitiveInformation()) {
   try {
    wiredPayload = newPayload(output(oldContent.getRawContent()));
   } catch (UnsupportedOperationException e) {
    wiredPayload = newPayload(output(oldContent.getInput()));
   }
 } else {
   try {
    wiredPayload = newPayload(oldContent.getRawContent());
   } catch (UnsupportedOperationException e) {
    wiredPayload = newPayload(oldContent.getInput());
   }
   output("Sensitive data in payload, use " + Constants.PROPERTY_LOGGER_WIRE_LOG_SENSITIVE_INFO + " override to enable logging this data.");
 }
 wiredPayload.setSensitive(oldContent.isSensitive());
 copyPayloadMetadata(oldContent, wiredPayload);
 request.setPayload(wiredPayload);
}

相关文章