Skip to content

Commit 7dcffad

Browse files
committed
Merge pull request #78 from shikui/master
1、将http 304作为正常状态处理;2、应为ETag,而不是ETags
2 parents 2f36702 + f5aef26 commit 7dcffad

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
</parent>
3232

3333
<properties>
34-
<elasticsearch.version>1.6.0</elasticsearch.version>
34+
<elasticsearch.version>1.6.2</elasticsearch.version>
3535
</properties>
3636

3737
<repositories>

src/main/java/org/wltea/analyzer/dic/Monitor.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,15 @@ public void run() {
6262
response = httpclient.execute(head);
6363

6464
//返回200 才做操作
65-
if(response.getStatusLine().getStatusCode()==200){
65+
if(response.getStatusLine().getStatusCode()==200 || response.getStatusLine().getStatusCode()==304){
6666

6767
if (!response.getLastHeader("Last-Modified").getValue().equalsIgnoreCase(last_modified)
68-
||!response.getLastHeader("ETags").getValue().equalsIgnoreCase(eTags)) {
68+
||!response.getLastHeader("ETag").getValue().equalsIgnoreCase(eTags)) {
6969

7070
// 远程词库有更新,需要重新加载词典,并修改last_modified,eTags
7171
Dictionary.getSingleton().reLoadMainDict();
7272
last_modified = response.getLastHeader("Last-Modified")==null?null:response.getLastHeader("Last-Modified").getValue();
73-
eTags = response.getLastHeader("ETags")==null?null:response.getLastHeader("ETags").getValue();
73+
eTags = response.getLastHeader("ETag")==null?null:response.getLastHeader("ETag").getValue();
7474
}
7575
}else{
7676
Dictionary.logger.info("remote_ext_dict {} return bad code {}" , location , response.getStatusLine().getStatusCode() );

0 commit comments

Comments
 (0)