refactoring favicon fetcher

This commit is contained in:
Athou
2013-06-11 07:18:04 +02:00
parent 3ee4f9807e
commit 17a1783789
5 changed files with 181 additions and 167 deletions

View File

@@ -141,7 +141,9 @@ public class HttpGetter {
}
long duration = System.currentTimeMillis() - start;
result = new HttpResult(content, lastModifiedHeader == null ? null
Header contentType = entity.getContentType();
result = new HttpResult(content, contentType == null ? null
: contentType.getValue(), lastModifiedHeader == null ? null
: lastModifiedHeader.getValue(), eTagHeader == null ? null
: eTagHeader.getValue(), duration);
} finally {
@@ -153,13 +155,15 @@ public class HttpGetter {
public static class HttpResult {
private byte[] content;
private String contentType;
private String lastModifiedSince;
private String eTag;
private long duration;
public HttpResult(byte[] content, String lastModifiedSince,
String eTag, long duration) {
public HttpResult(byte[] content, String contentType,
String lastModifiedSince, String eTag, long duration) {
this.content = content;
this.contentType = contentType;
this.lastModifiedSince = lastModifiedSince;
this.eTag = eTag;
this.duration = duration;
@@ -169,6 +173,10 @@ public class HttpGetter {
return content;
}
public String getContentType() {
return contentType;
}
public String getLastModifiedSince() {
return lastModifiedSince;
}