From 7229f06e0bc5c61dc17cb539c7b54273b66b16b6 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Thu, 8 Oct 2020 16:45:34 +0300 Subject: Sape: refactoring --- src/main/java/ru/sape/Sape.java | 3 +-- src/main/java/ru/sape/SapePageLinks.java | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/ru/sape/Sape.java b/src/main/java/ru/sape/Sape.java index bf975550..83a18331 100644 --- a/src/main/java/ru/sape/Sape.java +++ b/src/main/java/ru/sape/Sape.java @@ -35,10 +35,9 @@ public class Sape { "/code.php?user=" + sapeUser + "&host=" + host, "SAPE_Client PHP", socketTimeout, cacheLifeTime); } - public boolean debug = false; public Optional getPageLinks(URI requestUri, String cookie) { return sapePageLinkConnection.getData() - .map(site -> new SapePageLinks(site, sapeUser, requestUri, cookie, debug)); + .map(site -> new SapePageLinks(site, sapeUser, requestUri, cookie)); } } diff --git a/src/main/java/ru/sape/SapePageLinks.java b/src/main/java/ru/sape/SapePageLinks.java index 6cbfa42f..285d38f6 100644 --- a/src/main/java/ru/sape/SapePageLinks.java +++ b/src/main/java/ru/sape/SapePageLinks.java @@ -31,13 +31,13 @@ public class SapePageLinks { private final String linkDelimiter; private final List pageLinks; - public SapePageLinks(Site site, String sapeUser, URI request, String sapeCookie, boolean showPageCode) { + public SapePageLinks(Site site, String sapeUser, URI request, String sapeCookie) { String req = StringUtils.isNotEmpty(request.getQuery()) ? request.getPath() + "?" + request.getQuery() : request.getPath(); linkDelimiter = site.getDelimiter(); - this.showCode = showPageCode || sapeUser.equals(sapeCookie); + this.showCode = sapeUser.equals(sapeCookie); if (showCode) { pageLinks = Collections.singletonList(site.getCode()); -- cgit v1.2.3