net::ERR_CONTENT_LENGTH_MISMATCH 导致的个别字乱码

9 篇文章 0 订阅
1 篇文章 0 订阅

加载html文件含有中文时会让响应的Content-Length不准确导致的出现加载出中文个别字体乱码

后面发现是sitemesh装饰器bug导致的

<!-- 装饰容器 sitemesh 文档 http://wiki.sitemesh.org/wiki/display/sitemesh/Home  -->
<!--会导致html等页面出现加载失败或异常 在decorators.xml里排除就好-->
<filter>
    <filter-name>sitemeshFilter</filter-name>
    <filter-class>com.opensymphony.sitemesh.webapp.SiteMeshFilter</filter-class>
</filter>
<filter-mapping>
    <filter-name>sitemeshFilter</filter-name>
    <url-pattern>/*</url-pattern>
</filter-mapping>
<welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
</welcome-file-list>

 

修改decorators.xml文件 

<?xml version="1.0" encoding="UTF-8"?>
<!-- 文档https://my.oschina.net/heroShane/blog/199177 -->
<decorators defaultdir="/WEB-INF/webpage/decorators">
    <!-- 此处用来定义不需要过滤的页面 -->
    <excludes>
        <pattern>/static/*</pattern>
        <pattern>/upload/*</pattern>
        <pattern>/media/*</pattern>
    </excludes>
   <!-- 列表页装饰界面 -->
   <decorator name="list" page="list-theme.jsp" />
   <!-- 表单页面装饰界面 -->
   <decorator name="form" page="form-theme.jsp" />
   <!-- 表单页面装饰单页界面 -->
   <decorator name="single" page="single-theme.jsp" />
   <!-- grid选择页面装饰 -->
   <decorator name="grid-select" page="grid-select.jsp" />
   
</decorators>

解决办法:在excludes中排除需要访问的html页面就行了

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值