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

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

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

Encode.forJavaScript介绍

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

代码示例

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

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

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

/**
 * Encodes for a JavaScript string.
 *
 * @param s
 * @return Encoded String
 */
public static String encodeForJavaScript(String s) {
  return Encode.forJavaScript(s);
}

代码示例来源:origin: com.strategicgains/Syntaxe

@Override
  public String encode(String input)
  {
    return Encode.forJavaScript(input);
  }
}

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

/** {@inheritDoc} */
public String encodeForJavaScript(String s) {
  return Encode.forJavaScript(s);
}

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

/** {@inheritDoc} */
public String encodeForJavaScript(String s) {
  return Encode.forJavaScript(s);
}

代码示例来源:origin: com.strategicgains/Syntaxe

@Override
  public String encode(String input)
  {
    return Encode.forHtml(Encode.forJavaScript(input));
  }
}

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

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

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

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

代码示例来源:origin: org.wso2.carbon.registry/org.wso2.carbon.registry.resource.ui

public static String process(HttpServletRequest request, HttpServletResponse response,
               ServletConfig config, String resourcePath, String parentId)
    throws UIException {
  String cookie = (String) request.
      getSession().getAttribute(ServerConstants.ADMIN_SERVICE_COOKIE);
  ResourceServiceClient client;
  try {
    client = new ResourceServiceClient(cookie, config, request.getSession());
  } catch (Exception e) {
    String msg = "Failed to initialize the resource service client " +
        "to get resource tree data. " + e.getMessage();
    log.error(msg, e);
    throw new UIException(msg, e);
  }
  String textBoxId = Encode.forJavaScript(request.getParameter("textBoxId"));
  try {
    ResourceTreeData resourceTreeData = new ResourceTreeData();
    fillSubResourceTree(resourcePath, resourceTreeData, client,textBoxId, parentId,
        request.getParameter("hideResources") != null);
    String displayHTML = "";
    displayHTML += resourceTreeData.getResourceTree();
    return displayHTML;
  } catch (RegistryException e) {
    String msg = "Failed to generate the resource tree for the resource " +
        resourcePath + ". " + e.getMessage();
    log.error(msg, e);
    throw new UIException(msg, e);
  }
}

代码示例来源:origin: org.wso2.carbon.registry/org.wso2.carbon.registry.resource.ui

treeData.appendToTree("<a onclick=\"loadSubTree('" + childPaths[i] + "', '" + Encode.forJavaScript(parentId) + "_" + i + "', '" + Encode.forJavaScript(textBoxId) + "', '" + (hideResources? "true" : "false") + "')\">");
    treeData.appendToTree("<img src=\"../resources/images/icon-tree-plus.jpg\" id=\"plus_" + parentId + "_" + i + "\" style=\"margin-right:5px;\"  />" +
        "<img src=\"../resources/images/icon-tree-minus.jpg\" id=\"minus_" + Encode.forHtml(parentId) + "_" + i + "\" style=\"display:none;margin-right:5px;\"/>");
    treeData.appendToTree("<img src=\"../resources/images/spacer.gif\" style=\"width:18px;height:10px;\" />");
  treeData.appendToTree("<a onclick=\"pickPath('" + childPaths[i] + "','" + Encode.forJavaScript(textBoxId) + "', '" + Encode.forJavaScript(parentId) + "_" + i + "');\" title=\"" + childPaths[i] + "\">" +
      "<img src=\"../resources/images/" + getTreeFolderIcon(childResouceEntry) + "\" style=\"margin-right:2px;\" />" +
      resourceName +
} else {
  treeData.appendToTree("<img src=\"../resources/images/spacer.gif\" style=\"width:18px;height:10px;\" />");
  treeData.appendToTree("<a class=\"plane-resource\" onclick=\"pickPath('" + childPaths[i] + "','" + Encode.forJavaScript(textBoxId) + "', '" + Encode.forJavaScript(parentId) + "_" + i + "');\" title=\"" + childPaths[i] + "\">" + "<img src=\"../resources/images/" + getTreeResourceIcon(childResouceEntry) + "\" style=\"margin-right:2px;\"/>" + resourceName + "</a></div>");

代码示例来源:origin: com.github.susom/vertx-base

+ "else{window.name=\"windowId:\"+Math.floor(Math.random()*1e16).toString(36).slice(0, 8)"
   + "+\";q=\"+window.location.search+window.location.hash}\n"
   + "window.location.href='" + Encode.forJavaScript(absoluteContext(config::getString, rc) + "/login") + "';\n"
   + "</script></body></html>");
});

代码示例来源:origin: com.github.susom/vertx-base

+ "else{window.name=\"windowId:\"+Math.floor(Math.random()*1e16).toString(36).slice(0, 8)"
   + "+\";q=\"+window.location.search+window.location.hash}\n"
   + "window.location.href='" + Encode.forJavaScript(authUrl + params) + "';\n"
   + "</script></body></html>");
});

代码示例来源:origin: com.github.susom/vertx-base

+ "else{window.name=\"windowId:\"+Math.floor(Math.random()*1e16).toString(36).slice(0, 8)"
   + "+\";q=\"+window.location.search+window.location.hash}\n"
   + "window.location.href='" + Encode.forJavaScript(authUrl + params) + "';\n"
   + "</script></body></html>");
});

相关文章