开发者

What is the best way to manipulate a css file using a java servlet filter?

I need to convert relative image path (inside some css files) to absolute on the fly, using a java servlet filter.

What is 开发者_运维知识库the best way?


Create a Filter that intercepts the path to the CSS file. In that filter, load the CSS file and use a regex to match the CSS attribute you need to modify, capture the URL part, and replace it with what you need. Then write the modified CSS file to the servlet's output stream.


Give the CSS Parser Project a look...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜