网站页面静态化工具包

本工具包提供了一种网站静态化方案。可以根据动态网站的访问url生成对应的静态HTML文件到指定目录,然后再利用nginx输出静态页面,提升网站性能。本工具不依赖其他第三方工具类,只引用了日志类。源代码地址:https://github.com/onefly/html-generater网站页面静态化工具包两种使用方法如下1.spring配置<!–静态页面生成配置–><bean class="com.jd.generater.manager.GeneraterManager" destroy-method="destroy" lazy-init="false"><!–需要生成静态页面的配置列表–><constructor-arg name="urlFileList"><list><!–需要生成静态页面的配置对象–><bean class="com.jd.generater.domain.UrlFileConfig"><!–页面正确返回的校验关键字,一般取页面title中的文字即可,防止返回错误页面时覆盖原来的正确页面–><constructor-arg name="key" value="静态页面测试"/><!–静态页面生成路径–><constructor-arg name="path" value="/export/data/html/index.html"/><!–需要静态化的url–><constructor-arg name="url" value="http://localhost/index"/></bean></list></constructor-arg><constructor-arg name="ip" value="127.0.0.1"/><!–指定访问ip–><constructor-arg name="encoding" value="UTF-8"/><constructor-arg name="delay" value="10"/><!–延迟启动时间,单位秒–><constructor-arg name="period" value="120"/><!–周期执行时间,单位秒–></bean>2.直接创建对象,传入需要的参数即可 <无> .CodeEntity .code_pieces ul.piece_anchor{width:25px;position:absolute;top:25px;left:-30px;z-index:1000;}.CodeEntity .code_pieces ul.piece_anchor li{width:25px;background: #efe;margin-bottom:2px;}.CodeEntity .code_pieces ul.piece_anchor li{border-left:3px #40AA63 solid;border-right:3px #efe solid;}.CodeEntity .code_pieces ul.piece_anchor li:hover{border-right:3px #40AA63 solid;border-left:3px #efe solid;}.CodeEntity .code_pieces ul.piece_anchor li a{color: #333;padding: 3px 10px;}.CodeEntity .code_pieces .jump_to_code{visibility:hidden;position:relative;}.CodeEntity .code_pieces .code_piece:hover .jump_to_code{visibility:visible;}.CodeEntity .code_pieces .code_piece:hover .jump_to_code a{text-decoration:none;}.CodeEntity .code_pieces h2 i{float:right;font-style:normal;font-weight:normal;}.CodeEntity .code_pieces h2 i a{font-size:9pt;background: #FFFFFF;color:#00A;padding: 2px 5px;text-decoration:none;}

网站页面静态化工具包

相关文章:

你感兴趣的文章:

标签云: