使用一些过滤器来清理HTTP请求数据.
你可以去jsoup,它非常方便:
String unsafe = "<p><a href='http://example.com/' onclick='stealCookies()'>Link</a></p>";
String safe = Jsoup.clean(unsafe, Whitelist.basic());
// now: <p><a href="http://example.com/" rel="nofollow">Link</a></p>
Run Code Online (Sandbox Code Playgroud)
参考:http://jsoup.org/cookbook/cleaning-html/whitelist-sanitizer
| 归档时间: |
|
| 查看次数: |
8414 次 |
| 最近记录: |