提交 7dcffada 编写于 作者: weixin_43283383's avatar weixin_43283383

Merge pull request #78 from shikui/master

1、将http 304作为正常状态处理;2、应为ETag,而不是ETags
......@@ -31,7 +31,7 @@
</parent>
<properties>
<elasticsearch.version>1.6.0</elasticsearch.version>
<elasticsearch.version>1.6.2</elasticsearch.version>
</properties>
<repositories>
......
......@@ -62,15 +62,15 @@ public class Monitor implements Runnable {
response = httpclient.execute(head);
//返回200 才做操作
if(response.getStatusLine().getStatusCode()==200){
if(response.getStatusLine().getStatusCode()==200 || response.getStatusLine().getStatusCode()==304){
if (!response.getLastHeader("Last-Modified").getValue().equalsIgnoreCase(last_modified)
||!response.getLastHeader("ETags").getValue().equalsIgnoreCase(eTags)) {
||!response.getLastHeader("ETag").getValue().equalsIgnoreCase(eTags)) {
// 远程词库有更新,需要重新加载词典,并修改last_modified,eTags
Dictionary.getSingleton().reLoadMainDict();
last_modified = response.getLastHeader("Last-Modified")==null?null:response.getLastHeader("Last-Modified").getValue();
eTags = response.getLastHeader("ETags")==null?null:response.getLastHeader("ETags").getValue();
eTags = response.getLastHeader("ETag")==null?null:response.getLastHeader("ETag").getValue();
}
}else{
Dictionary.logger.info("remote_ext_dict {} return bad code {}" , location , response.getStatusLine().getStatusCode() );
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册