From 0ff769e633d5d7c07374897ca76272a7d09872b0 Mon Sep 17 00:00:00 2001 From: Simone Bordet Date: Wed, 12 Dec 2012 18:35:10 +0100 Subject: [PATCH] Introduced HttpCookieStore.Empty to disable cookies in HttpClient and in the websocket client. --- .../eclipse/jetty/util/HttpCookieStore.java | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/HttpCookieStore.java b/jetty-util/src/main/java/org/eclipse/jetty/util/HttpCookieStore.java index 30bc0dcbe8c..14f45a3e1dc 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/HttpCookieStore.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/HttpCookieStore.java @@ -22,6 +22,7 @@ import java.net.CookieManager; import java.net.CookieStore; import java.net.HttpCookie; import java.net.URI; +import java.util.Collections; import java.util.List; /** @@ -72,4 +73,42 @@ public class HttpCookieStore implements CookieStore { return delegate.removeAll(); } + + public static class Empty implements CookieStore + { + @Override + public void add(URI uri, HttpCookie cookie) + { + } + + @Override + public List get(URI uri) + { + return Collections.emptyList(); + } + + @Override + public List getCookies() + { + return Collections.emptyList(); + } + + @Override + public List getURIs() + { + return Collections.emptyList(); + } + + @Override + public boolean remove(URI uri, HttpCookie cookie) + { + return false; + } + + @Override + public boolean removeAll() + { + return false; + } + } }