This is to carry the previous notes.
When using Javaweb to do the project, encountered the filter to the CSS files, such as filtering, resulting in the layout of HTML invalidation, the solution is then filter in the judgment, when encountered CSS files, png,jpg pictures, etc., release. The code is as follows
public void DoFilter (ServletRequest request, servletresponse response, Filterchain chain) throws IOException, servletexception { httpservletrequest req= (httpservletrequest) request; HttpServletResponse res= (httpservletresponse) response; Gets the path of the request interface String A=req.getrequesturi (); if (A.contains (". css") | | | a.contains (". js") | | a.contains (". png") | | a.contains (". jpg")) { //if found to be CSS or JS file, direct release Chain.dofilter (request, response); } }
This will solve the problem.
Learning Diary: A workaround for filtering CSS files in the Javaweb filter