本文整理了Java中org.jooby.Env.xss()
方法的一些代码示例,展示了Env.xss()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Env.xss()
方法的具体详情如下:
包路径:org.jooby.Env
类名称:Env
方法名:xss
[英]Get or chain the required xss functions.
[中]获取或链接所需的xss函数。
代码示例来源:origin: jooby-project/jooby
@Override
public void configure(final Env env, final Config conf, final Binder binder) {
// contribute CSL escape functions
env.xss("html", Escape::html)
.xss("htmlText", Escape::htmlText)
.xss("js", Escape::jsString)
.xss("jsRegex", Escape::jsRegex)
.xss("css", Escape::cssString)
.xss("uri", Escape::uri);
}
代码示例来源:origin: jooby-project/jooby
private String xss(final String value, final String... xss) {
return env.xss(xss).apply(value);
}
}
代码示例来源:origin: jooby-project/jooby
public String apply(final String value, final String... xss) {
return env.xss(xss).apply(value);
}
代码示例来源:origin: jooby-project/jooby
@Override
public void configure(final Env env, final Config conf, final Binder binder) {
env.xss("html", it -> HtmlEscape.escapeHtml(it, htmltype, htmllevel))
.xss("js", it -> JavaScriptEscape.escapeJavaScript(it, jstype, jslevel))
.xss("json", it -> JsonEscape.escapeJson(it, jsontype, jsonlevel))
.xss("css", it -> CssEscape.escapeCssString(it, csstype, csslevel))
.xss("uri", UriEscape::escapeUriPath)
.xss("queryParam", UriEscape::escapeUriQueryParam)
.xss("uriFragmentId", UriEscape::escapeUriFragmentId);
}
代码示例来源:origin: jooby-project/jooby
@Override
public Object execute(final Map<String, Object> args) {
args.remove("_context");
args.remove("_self");
Object[] values = args.values().toArray(new Object[args.size()]);
String[] xss = new String[values.length - 1];
System.arraycopy(values, 1, xss, 0, values.length - 1);
return env.xss(xss).apply(values[0].toString());
}
});
代码示例来源:origin: jooby-project/jooby
/**
* Get or chain the required xss functions.
*
* @param xss XSS to combine.
* @return Chain of required xss functions.
*/
@Nonnull
default Function<String, String> xss(final String... xss) {
Map<String, Function<String, String>> fn = xss();
BinaryOperator<Function<String, String>> reduce = Function::andThen;
return Arrays.asList(xss)
.stream()
.map(fn::get)
.filter(Objects::nonNull)
.reduce(Function.identity(), reduce);
}
代码示例来源:origin: jooby-project/jooby
private void xss(final Env env) {
Escaper ufe = UrlEscapers.urlFragmentEscaper();
Escaper fpe = UrlEscapers.urlFormParameterEscaper();
Escaper pse = UrlEscapers.urlPathSegmentEscaper();
Escaper html = HtmlEscapers.htmlEscaper();
env.xss("urlFragment", ufe::escape)
.xss("formParam", fpe::escape)
.xss("pathSegment", pse::escape)
.xss("html", html::escape);
}
代码示例来源:origin: jooby-project/jooby
private Function<String, String> xss(final String... xss) {
return require(Env.class).xss(xss);
}
代码示例来源:origin: jooby-project/jooby
@SuppressWarnings({"rawtypes", "unchecked"})
@Override
public Object exec(final List arguments) throws TemplateModelException {
List<String> args = (List<String>) arguments.stream()
.map(it -> Try.apply(() -> ((TemplateScalarModel) it).getAsString()).get())
.collect(Collectors.toList());
String[] xss = args.subList(1, args.size())
.toArray(new String[arguments.size() - 1]);
return env.xss(xss).apply(args.get(0));
}
代码示例来源:origin: jooby-project/jooby
String[] xss = new String[opts.params.length];
System.arraycopy(opts.params, 0, xss, 0, opts.params.length);
return new Handlebars.SafeString(env.xss(xss).apply(value.toString()));
});
代码示例来源:origin: org.jooby/jooby-csl
@Override
public void configure(final Env env, final Config conf, final Binder binder) {
// contribute CSL escape functions
env.xss("html", Escape::html)
.xss("htmlText", Escape::htmlText)
.xss("js", Escape::jsString)
.xss("jsRegex", Escape::jsRegex)
.xss("css", Escape::cssString)
.xss("uri", Escape::uri);
}
代码示例来源:origin: org.jooby/jooby-thymeleaf
private String xss(final String value, final String... xss) {
return env.xss(xss).apply(value);
}
}
代码示例来源:origin: org.jooby/jooby-pebble
@Override
public Object execute(final Map<String, Object> args) {
args.remove("_context");
args.remove("_self");
Object[] values = args.values().toArray(new Object[args.size()]);
String[] xss = new String[values.length - 1];
System.arraycopy(values, 1, xss, 0, values.length - 1);
return env.xss(xss).apply(values[0].toString());
}
});
代码示例来源:origin: org.jooby/jooby
private void xss(final Env env) {
Escaper ufe = UrlEscapers.urlFragmentEscaper();
Escaper fpe = UrlEscapers.urlFormParameterEscaper();
Escaper pse = UrlEscapers.urlPathSegmentEscaper();
Escaper html = HtmlEscapers.htmlEscaper();
env.xss("urlFragment", ufe::escape)
.xss("formParam", fpe::escape)
.xss("pathSegment", pse::escape)
.xss("html", html::escape);
}
代码示例来源:origin: org.jooby/jooby
/**
* Get or chain the required xss functions.
*
* @param xss XSS to combine.
* @return Chain of required xss functions.
*/
@Nonnull
default Function<String, String> xss(final String... xss) {
Map<String, Function<String, String>> fn = xss();
BinaryOperator<Function<String, String>> reduce = Function::andThen;
return Arrays.asList(xss)
.stream()
.map(fn::get)
.filter(Objects::nonNull)
.reduce(Function.identity(), reduce);
}
代码示例来源:origin: org.jooby/jooby
private Function<String, String> xss(final String... xss) {
return require(Env.class).xss(xss);
}
代码示例来源:origin: org.jooby/jooby-ftl
@SuppressWarnings({"rawtypes", "unchecked"})
@Override
public Object exec(final List arguments) throws TemplateModelException {
List<String> args = (List<String>) arguments.stream()
.map(it -> Try.apply(() -> ((TemplateScalarModel) it).getAsString()).get())
.collect(Collectors.toList());
String[] xss = args.subList(1, args.size())
.toArray(new String[arguments.size() - 1]);
return env.xss(xss).apply(args.get(0));
}
代码示例来源:origin: org.jooby/jooby-hbs
String[] xss = new String[opts.params.length];
System.arraycopy(opts.params, 0, xss, 0, opts.params.length);
return new Handlebars.SafeString(env.xss(xss).apply(value.toString()));
});
内容来源于网络,如有侵权,请联系作者删除!