diff options
Diffstat (limited to 'juick-www/src/main/java/ru')
-rw-r--r-- | juick-www/src/main/java/ru/sape/Sape.java | 6 | ||||
-rw-r--r-- | juick-www/src/main/java/ru/sape/SapePageLinks.java | 23 |
2 files changed, 6 insertions, 23 deletions
diff --git a/juick-www/src/main/java/ru/sape/Sape.java b/juick-www/src/main/java/ru/sape/Sape.java index c00054ae..38577c45 100644 --- a/juick-www/src/main/java/ru/sape/Sape.java +++ b/juick-www/src/main/java/ru/sape/Sape.java @@ -3,8 +3,6 @@ */ package ru.sape; -import javax.servlet.http.Cookie; - public class Sape { private final String sapeUser; @@ -19,7 +17,7 @@ public class Sape { } public boolean debug = false; - public SapePageLinks getPageLinks(String requestUri, Cookie[] cookies) { - return new SapePageLinks(sapePageLinkConnection, sapeUser, requestUri, cookies, debug); + public SapePageLinks getPageLinks(String requestUri, String cookie) { + return new SapePageLinks(sapePageLinkConnection, sapeUser, requestUri, cookie, debug); } } diff --git a/juick-www/src/main/java/ru/sape/SapePageLinks.java b/juick-www/src/main/java/ru/sape/SapePageLinks.java index 458358b8..e89b4e71 100644 --- a/juick-www/src/main/java/ru/sape/SapePageLinks.java +++ b/juick-www/src/main/java/ru/sape/SapePageLinks.java @@ -1,19 +1,18 @@ package ru.sape; import java.util.*; -import javax.servlet.http.Cookie; public class SapePageLinks { private boolean showCode; - public SapePageLinks(SapeConnection sapeConnection, String sapeUser, String requestUri, Cookie[] cookies) { - this(sapeConnection, sapeUser, requestUri, cookies, false); + public SapePageLinks(SapeConnection sapeConnection, String sapeUser, String requestUri, String sapeCookie) { + this(sapeConnection, sapeUser, requestUri, sapeCookie, false); } @SuppressWarnings("unchecked") - public SapePageLinks(SapeConnection sapeConnection, String sapeUser, String requestUri, Cookie[] cookies, boolean showCode) { - if (sapeUser.equals(getCookieValue(cookies, "sape_cookie"))) { + public SapePageLinks(SapeConnection sapeConnection, String sapeUser, String requestUri, String sapeCookie, boolean showCode) { + if (sapeUser.equals(sapeCookie)) { showCode = true; } @@ -74,18 +73,4 @@ public class SapePageLinks { return s.toString(); } - - private static String getCookieValue(Cookie[] cookies, String name) { - if (cookies == null) { - return null; - } - - for (Cookie cookie : cookies) { - if (cookie.getName().equals(name)) { - return cookie.getValue(); - } - } - - return null; - } } |