本文整理了Java中org.owasp.encoder.Encode.forJava()
方法的一些代码示例,展示了Encode.forJava()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Encode.forJava()
方法的具体详情如下:
包路径:org.owasp.encoder.Encode
类名称:Encode
方法名:forJava
[英]See #forJava(String) for description of encoding. This version writes directly to a Writer without an intervening string.
[中]有关编码的说明,请参见#forJava(字符串)。此版本直接写入写入程序,无需插入字符串。
代码示例来源:origin: primefaces/primefaces
/**
* @see Encode#forJava(String)
*/
public static String forJava(String input) {
return Encode.forJava(input);
}
代码示例来源:origin: networknt/light-4j
} catch (FileNotFoundException ex) {
if (logger.isInfoEnabled()) {
logger.info("Unable to load config from externalized folder for " + Encode.forJava(configFilename + " in " + EXTERNALIZED_PROPERTY_DIR));
logger.info("Config loaded from externalized folder for " + Encode.forJava(configFilename + " in " + EXTERNALIZED_PROPERTY_DIR));
logger.info("Trying to load config from classpath directory for file " + Encode.forJava(configFilename));
logger.info("config loaded from classpath for " + Encode.forJava(configFilename));
if (inStream != null) {
if (logger.isInfoEnabled()) {
logger.info("Config loaded from default folder for " + Encode.forJava(configFilename));
logger.info("Unable to load config " + Encode.forJava(configFilename) + ". Looking for the same file name with extension yaml...");
} else if (configFilename.endsWith(CONFIG_EXT_YAML)) {
logger.info("Unable to load config " + Encode.forJava(configFilename) + ". Looking for the same file name with extension json...");
} else {
System.out.println("Unable to load config '" + Encode.forJava(configFilename.substring(0, configFilename.indexOf("."))) + "' with extension yml, yaml and json from external config, application config and module config. Please ignore this message if you are sure that your application is not using this config file.");
代码示例来源:origin: networknt/light-4j
cert = (X509Certificate) cf.generateCertificate(inStream);
} else {
logger.info("Certificate " + Encode.forJava(filename) + " not found.");
代码示例来源:origin: networknt/light-4j
public static String maskJson(DocumentContext ctx, String key) {
Map<String, Object> jsonConfig = (Map<String, Object>) config.get(MASK_TYPE_JSON);
if (jsonConfig != null) {
Map<String, Object> patternMap = (Map<String, Object>) jsonConfig.get(key);
if (patternMap != null) {
JsonNode configNode = Config.getInstance().getMapper().valueToTree(patternMap);
Iterator<Map.Entry<String, JsonNode>> iterator = configNode.fields();
while (iterator.hasNext()) {
Map.Entry<String, JsonNode> entry = iterator.next();
applyMask(entry, ctx);
}
return ctx.jsonString();
} else {
logger.warn("mask.json doesn't contain the key {} ", Encode.forJava(key));
}
}
return ctx.jsonString();
}
代码示例来源:origin: networknt/light-4j
String trustStorePass = System.getProperty(TRUST_STORE_PASSWORD_PROPERTY);
if (trustStoreName != null && trustStorePass != null) {
if(logger.isInfoEnabled()) logger.info("Loading trust store from system property at " + Encode.forJava(trustStoreName));
} else {
trustStoreName = (String) tlsMap.get(TRUST_STORE);
trustStorePass = (String)secretConfig.get(SecretConstants.CLIENT_TRUSTSTORE_PASS);
if(logger.isInfoEnabled()) logger.info("Loading trust store from config at " + Encode.forJava(trustStoreName));
代码示例来源:origin: openmrs/openmrs-core
/**
* Encodes for a Java string.
*
* @param s
* @return Encoded String
*/
public static String encodeForJava(String s) {
return Encode.forJava(s);
}
代码示例来源:origin: it.ozimov/spring-boot-email-core
/**
* Sanitize text to prevent injection of EOL characters into log messages.
* <p>
* Actually, replaces all whitespaces including CR and LF with a space and all other ASCII control
* characters with "?" to avoid malicious code in the logs.
*/
private static String sanitizeString(String text) {
return Encode.forJava(text);
}
代码示例来源:origin: ozimov/spring-boot-email-tools
/**
* Sanitize text to prevent injection of EOL characters into log messages.
* <p>
* Actually, replaces all whitespaces including CR and LF with a space and all other ASCII control
* characters with "?" to avoid malicious code in the logs.
*/
private static String sanitizeString(String text) {
return Encode.forJava(text);
}
代码示例来源:origin: com.networknt/config
} catch (FileNotFoundException ex) {
if (logger.isInfoEnabled()) {
logger.info("Unable to load config from externalized folder for " + Encode.forJava(configFilename + " in " + EXTERNALIZED_PROPERTY_DIR));
logger.info("Config loaded from externalized folder for " + Encode.forJava(configFilename + " in " + EXTERNALIZED_PROPERTY_DIR));
logger.info("Trying to load config from classpath directory for file " + Encode.forJava(configFilename));
logger.info("config loaded from classpath for " + Encode.forJava(configFilename));
if (inStream != null) {
if (logger.isInfoEnabled()) {
logger.info("Config loaded from default folder for " + Encode.forJava(configFilename));
logger.info("Unable to load config " + Encode.forJava(configFilename) + ". Looking for the same file name with extension yaml...");
} else if (configFilename.endsWith(CONFIG_EXT_YAML)) {
logger.info("Unable to load config " + Encode.forJava(configFilename) + ". Looking for the same file name with extension json...");
} else {
System.out.println("Unable to load config '" + Encode.forJava(configFilename.substring(0, configFilename.indexOf("."))) + "' with extension yml, yaml and json from external config, application config and module config. Please ignore this message if you are sure that your application is not using this config file.");
代码示例来源:origin: com.networknt/security
cert = (X509Certificate) cf.generateCertificate(inStream);
} else {
logger.info("Certificate " + Encode.forJava(filename) + " not found.");
代码示例来源:origin: com.networknt/client
String trustStorePass = System.getProperty(TRUST_STORE_PASSWORD_PROPERTY);
if (trustStoreName != null && trustStorePass != null) {
if(logger.isInfoEnabled()) logger.info("Loading trust store from system property at " + Encode.forJava(trustStoreName));
} else {
trustStoreName = (String) tlsMap.get(TRUST_STORE);
trustStorePass = (String)secretConfig.get(SecretConstants.CLIENT_TRUSTSTORE_PASS);
if(logger.isInfoEnabled()) logger.info("Loading trust store from config at " + Encode.forJava(trustStoreName));
代码示例来源:origin: com.networknt/mask
public static String maskJson(DocumentContext ctx, String key) {
Map<String, Object> jsonConfig = (Map<String, Object>) config.get(MASK_TYPE_JSON);
if (jsonConfig != null) {
Map<String, Object> patternMap = (Map<String, Object>) jsonConfig.get(key);
if (patternMap != null) {
JsonNode configNode = Config.getInstance().getMapper().valueToTree(patternMap);
Iterator<Map.Entry<String, JsonNode>> iterator = configNode.fields();
while (iterator.hasNext()) {
Map.Entry<String, JsonNode> entry = iterator.next();
applyMask(entry, ctx);
}
return ctx.jsonString();
} else {
logger.warn("mask.json doesn't contain the key {} ", Encode.forJava(key));
}
}
return ctx.jsonString();
}
内容来源于网络,如有侵权,请联系作者删除!