Commit e0d68299 by fsn

更新xss

parent a3dd67c6
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
4. 对常用js插件进行二次封装,使js代码变得简洁,更加易维护,具体请见webapp/static/js/common文件夹内js代码。 4. 对常用js插件进行二次封装,使js代码变得简洁,更加易维护,具体请见webapp/static/js/common文件夹内js代码。
5. 利用ehcache框架对经常调用的查询进行缓存,提升运行速度,具体请见ConstantFactory类中@Cacheable标记的方法。 5. 利用ehcache框架对经常调用的查询进行缓存,提升运行速度,具体请见ConstantFactory类中@Cacheable标记的方法。
6. controller层采用map + warpper方式的返回结果,返回给前端更为灵活的数据,具体参见com.stylefeng.guns.modular.system.warpper包中具体类。 6. controller层采用map + warpper方式的返回结果,返回给前端更为灵活的数据,具体参见com.stylefeng.guns.modular.system.warpper包中具体类。
7. 防止XSS攻击,通过XssFilter类对所有的输入的非法字符串进行过滤以及替换。
##零spring xml配置示例 ##零spring xml配置示例
以下配置示例仅列出部分spring配置,详情请见com.stylefeng.guns.project.config包中具体的配置类 以下配置示例仅列出部分spring配置,详情请见com.stylefeng.guns.project.config包中具体的配置类
......
...@@ -10,29 +10,17 @@ public class XssFilter implements Filter { ...@@ -10,29 +10,17 @@ public class XssFilter implements Filter {
FilterConfig filterConfig = null; FilterConfig filterConfig = null;
public void init(FilterConfig filterConfig) throws ServletException { public void init(FilterConfig filterConfig) throws ServletException {
this.filterConfig = filterConfig; this.filterConfig = filterConfig;
} }
public void destroy() { public void destroy() {
this.filterConfig = null; this.filterConfig = null;
} }
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException {
chain.doFilter(new XssHttpServletRequestWrapper( chain.doFilter(new XssHttpServletRequestWrapper(
(HttpServletRequest) request), response); (HttpServletRequest) request), response);
} }
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment