org.owasp.encoder.Encode.forJavaScriptSource()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 JavaScript  
字(3.3k)|赞(0)|评价(0)|浏览(233)

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

Encode.forJavaScriptSource介绍

[英]See #forJavaScriptSource(String) for description of encoding. This version writes directly to a Writer without an intervening string.
[中]有关编码的说明,请参见#forJavaScriptSource(字符串)。此版本直接写入写入程序,无需插入字符串。

代码示例

代码示例来源:origin: primefaces/primefaces

/**
 * @see Encode#forJavaScriptSource(String)
 */
public static String forJavaScriptSource(String input) {
  return Encode.forJavaScriptSource(input);
}

代码示例来源:origin: networknt/light-4j

public void encodeList(List list) {
  for (int i = 0; i < list.size(); i++) {
    if (list.get(i) instanceof String) {
      list.set(i, Encode.forJavaScriptSource((String)list.get(i)));
    } else if(list.get(i) instanceof Map) {
      encodeNode((Map<String, Object>)list.get(i));
    } else if(list.get(i) instanceof List) {
      encodeList((List)list.get(i));
    }
  }
}

代码示例来源:origin: networknt/light-4j

public void encodeNode(Map<String, Object> map) {
  for (Map.Entry<String, Object> entry : map.entrySet()) {
    String key = entry.getKey();
    Object value = entry.getValue();
    if (value instanceof String)
      map.put(key, Encode.forJavaScriptSource((String) value));
    else if (value instanceof Map)
      encodeNode((Map) value);
    else if (value instanceof List) {
      encodeList((List)value);
    }
  }
}

代码示例来源:origin: networknt/light-4j

ListIterator<String> itValues = values.listIterator();
while (itValues.hasNext()) {
  String value = Encode.forJavaScriptSource(itValues.next());
  itValues.set(value);

代码示例来源:origin: openmrs/openmrs-core

/**
 * Encodes for JavaScript strings contained within a JavaScript or JSON file.
 *
 * @param s
 * @return Encoded String
 */
public static String encodeForJavaScriptSource(String s) {
  return Encode.forJavaScriptSource(s);
}

代码示例来源:origin: OWASP/owasp-java-encoder

@Override
  public void doTag() throws JspException, IOException {
    Encode.forJavaScriptSource(getJspContext().getOut(), _value);
  }
}

代码示例来源:origin: org.owasp.encoder/encoder-jsp

@Override
  public void doTag() throws JspException, IOException {
    Encode.forJavaScriptSource(getJspContext().getOut(), _value);
  }
}

代码示例来源:origin: networknt/light

eventData.putAll((Map<String, Object>) inputMap.get("data"));
if(eventData.get("title") != null) {
  eventData.put("title", Encode.forJavaScriptSource((String)eventData.get("title")));
  eventData.put("originalAuthor", Encode.forJavaScriptSource((String)eventData.get("originalAuthor")));
  eventData.put("originalSite", Encode.forJavaScriptSource((String)eventData.get("originalSite")));

代码示例来源:origin: networknt/light

eventData.put("host", data.get("host"));
eventData.put("entityId", post.getProperty("entityId"));
eventData.put("title", Encode.forJavaScriptSource((String)data.get("title")));
eventData.put("originalAuthor", Encode.forJavaScriptSource((String)data.get("originalAuthor")));
eventData.put("originalSite", Encode.forJavaScriptSource((String)data.get("originalSite")));
eventData.put("originalUrl", Encode.forUriComponent((String)data.get("originalUrl")));
eventData.put("summary", data.get("summary"));

相关文章