From 3f322626546f99c795bd1343e8d3d131926ef616 Mon Sep 17 00:00:00 2001 From: reger Date: Fri, 9 Dec 2016 00:33:20 +0100 Subject: [PATCH] enable getCookies for HeaderFramework reusing Jetty CookieCutter --- source/net/yacy/cora/protocol/RequestHeader.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/source/net/yacy/cora/protocol/RequestHeader.java b/source/net/yacy/cora/protocol/RequestHeader.java index 9d55d2d1b..4c4622097 100644 --- a/source/net/yacy/cora/protocol/RequestHeader.java +++ b/source/net/yacy/cora/protocol/RequestHeader.java @@ -48,6 +48,7 @@ import javax.servlet.http.Part; import net.yacy.cora.document.id.DigestURL; import net.yacy.cora.document.id.MultiProtocolURL; import net.yacy.cora.util.NumberTools; +import org.eclipse.jetty.server.CookieCutter; /** * YaCy servlet request header. @@ -229,8 +230,15 @@ public class RequestHeader extends HeaderFramework implements HttpServletRequest public Cookie[] getCookies() { if (_request != null) { return _request.getCookies(); + } else { + String cstr = super.get(COOKIE); + if (cstr != null) { + CookieCutter cc = new CookieCutter(); // reuse jetty cookie parser + cc.addCookieField(cstr); + return cc.getCookies(); + } + return null; } - throw new UnsupportedOperationException("Not supported yet."); } @Override