mirror of
https://github.com/Athou/commafeed.git
synced 2026-03-21 21:37:29 +00:00
less boilerplate
This commit is contained in:
@@ -15,6 +15,7 @@ import javax.net.ssl.SSLContext;
|
|||||||
import javax.net.ssl.TrustManager;
|
import javax.net.ssl.TrustManager;
|
||||||
import javax.net.ssl.X509TrustManager;
|
import javax.net.ssl.X509TrustManager;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
@@ -195,47 +196,15 @@ public class HttpGetter {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@RequiredArgsConstructor
|
||||||
public static class HttpResult {
|
public static class HttpResult {
|
||||||
|
private final byte[] content;
|
||||||
private byte[] content;
|
private final String contentType;
|
||||||
private String contentType;
|
private final String lastModifiedSince;
|
||||||
private String lastModifiedSince;
|
private final String eTag;
|
||||||
private String eTag;
|
private final long duration;
|
||||||
private long duration;
|
private final String urlAfterRedirect;
|
||||||
private String urlAfterRedirect;
|
|
||||||
|
|
||||||
private HttpResult(byte[] content, String contentType, String lastModifiedSince, String eTag, long duration, String urlAfterRedirect) {
|
|
||||||
this.content = content;
|
|
||||||
this.contentType = contentType;
|
|
||||||
this.lastModifiedSince = lastModifiedSince;
|
|
||||||
this.eTag = eTag;
|
|
||||||
this.duration = duration;
|
|
||||||
this.urlAfterRedirect = urlAfterRedirect;
|
|
||||||
}
|
|
||||||
|
|
||||||
public byte[] getContent() {
|
|
||||||
return content;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getContentType() {
|
|
||||||
return contentType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getLastModifiedSince() {
|
|
||||||
return lastModifiedSince;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String geteTag() {
|
|
||||||
return eTag;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getDuration() {
|
|
||||||
return duration;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getUrlAfterRedirect() {
|
|
||||||
return urlAfterRedirect;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static CloseableHttpClient newClient(int timeout) {
|
public static CloseableHttpClient newClient(int timeout) {
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ public class FeedFetcher {
|
|||||||
|
|
||||||
Feed feed = fetchedFeed.getFeed();
|
Feed feed = fetchedFeed.getFeed();
|
||||||
feed.setLastModifiedHeader(result.getLastModifiedSince());
|
feed.setLastModifiedHeader(result.getLastModifiedSince());
|
||||||
feed.setEtagHeader(FeedUtils.truncate(result.geteTag(), 255));
|
feed.setEtagHeader(FeedUtils.truncate(result.getETag(), 255));
|
||||||
feed.setLastContentHash(hash);
|
feed.setLastContentHash(hash);
|
||||||
fetchedFeed.setFetchDuration(result.getDuration());
|
fetchedFeed.setFetchDuration(result.getDuration());
|
||||||
fetchedFeed.setUrlAfterRedirect(result.getUrlAfterRedirect());
|
fetchedFeed.setUrlAfterRedirect(result.getUrlAfterRedirect());
|
||||||
|
|||||||
Reference in New Issue
Block a user