本文整理汇总了Java中org.owasp.validator.html.PolicyException类的典型用法代码示例。如果您正苦于以下问题:Java PolicyException类的具体用法?Java PolicyException怎么用?Java PolicyException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PolicyException类属于org.owasp.validator.html包,在下文中一共展示了PolicyException类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: AntiSamyFilter
import org.owasp.validator.html.PolicyException; //导入依赖的package包/类
public AntiSamyFilter() {
try {
InputStream is = this.getClass().getResourceAsStream("/antisamy/antisamy-ebay.xml");
Policy policy = Policy.getInstance(is);
antiSamy = new AntiSamy(policy);
} catch (PolicyException e) {
throw new IllegalStateException(e.getMessage(), e);
}
}
示例2: getPolicy
import org.owasp.validator.html.PolicyException; //导入依赖的package包/类
public static Policy getPolicy() throws PolicyException, ServiceException {
if (policy == null) {
ClassPathResource classPathResource = new ClassPathResource("/antisamy/spark-antisamy.xml");
if (classPathResource == null || !classPathResource.exists()) {
throw new ServiceException("spark-antisamy.xml is not exists!");
}
InputStream policyFile = XssClean.class.getResourceAsStream("/antisamy/spark-antisamy.xml");
if (policyFile == null) {
throw new ServiceException("spark-antisamy.xml is not exists!");
}
policy = Policy.getInstance(policyFile);
}
return policy;
}