public final class HtmlFilter extends Object
此类中的方法非线程安全
String clean = new HTMLFilter().filter(input);
此类来自:http://xss-html-filter.sf.net
Constructor and Description |
---|
HtmlFilter()
Default constructor.
|
HtmlFilter(boolean debug)
Set debug flag to true.
|
HtmlFilter(Map<String,Object> conf)
Map-parameter configurable constructor.
|
Modifier and Type | Method and Description |
---|---|
String |
filter(String input)
given a user submitted input String, filter out any invalid or restricted html.
|
static String |
htmlSpecialChars(String s)
HTML特殊字符替换
|
boolean |
isAlwaysMakeTags()
flag determining whether to try to make tags when presented with "unbalanced" angle brackets (e.g.
|
boolean |
isStripComments()
flag determining whether comments are allowed in input String.
|
public HtmlFilter()
public HtmlFilter(boolean debug)
debug
- turn debug on with a true argumentpublic static String htmlSpecialChars(String s)
s
- HTMLpublic String filter(String input)
input
- text (i.e. submitted by a user) than may contain htmlpublic boolean isAlwaysMakeTags()
public boolean isStripComments()
Copyright © 2025. All rights reserved.