You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by se...@apache.org on 2010/12/04 20:01:02 UTC
svn commit: r1042225 - in
/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http:
client/params/CookiePolicy.java impl/client/DefaultHttpClient.java
impl/cookie/IgnoreSpec.java impl/cookie/IgnoreSpecFactory.java
Author: sebb
Date: Sat Dec 4 19:01:02 2010
New Revision: 1042225
URL: http://svn.apache.org/viewvc?rev=1042225&view=rev
Log:
HTTPCLIENT-1030) Implement "ignoreCookies" CookieSpec
Added:
httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/IgnoreSpec.java (with props)
httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/IgnoreSpecFactory.java (with props)
Modified:
httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/client/params/CookiePolicy.java
httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/DefaultHttpClient.java
Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/client/params/CookiePolicy.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/client/params/CookiePolicy.java?rev=1042225&r1=1042224&r2=1042225&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/client/params/CookiePolicy.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/client/params/CookiePolicy.java Sat Dec 4 19:01:02 2010
@@ -63,6 +63,13 @@ public final class CookiePolicy {
*/
public static final String BEST_MATCH = "best-match";
+ /**
+ * The policy that ignores cookies.
+ *
+ * @since 4.1-beta1
+ */
+ public static final String IGNORE_COOKIES = "ignoreCookies";
+
private CookiePolicy() {
super();
}
Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/DefaultHttpClient.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/DefaultHttpClient.java?rev=1042225&r1=1042224&r2=1042225&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/DefaultHttpClient.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/DefaultHttpClient.java Sat Dec 4 19:01:02 2010
@@ -67,6 +67,7 @@ import org.apache.http.impl.conn.Default
import org.apache.http.impl.conn.SingleClientConnManager;
import org.apache.http.impl.cookie.BestMatchSpecFactory;
import org.apache.http.impl.cookie.BrowserCompatSpecFactory;
+import org.apache.http.impl.cookie.IgnoreSpecFactory;
import org.apache.http.impl.cookie.NetscapeDraftSpecFactory;
import org.apache.http.impl.cookie.RFC2109SpecFactory;
import org.apache.http.impl.cookie.RFC2965SpecFactory;
@@ -326,6 +327,9 @@ public class DefaultHttpClient extends A
registry.register(
CookiePolicy.RFC_2965,
new RFC2965SpecFactory());
+ registry.register(
+ CookiePolicy.IGNORE_COOKIES,
+ new IgnoreSpecFactory());
return registry;
}
Added: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/IgnoreSpec.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/IgnoreSpec.java?rev=1042225&view=auto
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/IgnoreSpec.java (added)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/IgnoreSpec.java Sat Dec 4 19:01:02 2010
@@ -0,0 +1,63 @@
+/*
+ * ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ *
+ */
+
+package org.apache.http.impl.cookie;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.http.Header;
+import org.apache.http.annotation.NotThreadSafe;
+import org.apache.http.cookie.Cookie;
+import org.apache.http.cookie.CookieOrigin;
+import org.apache.http.cookie.MalformedCookieException;
+
+/**
+ * CookieSpec that ignores all cookies
+ *
+ * @since 4.1
+ */
+@NotThreadSafe // superclass is @NotThreadSafe
+public class IgnoreSpec extends CookieSpecBase {
+
+ public int getVersion() {
+ return 0;
+ }
+
+ public List<Cookie> parse(Header header, CookieOrigin origin)
+ throws MalformedCookieException {
+ return Collections.emptyList();
+ }
+
+ public List<Header> formatCookies(List<Cookie> cookies) {
+ return Collections.emptyList();
+ }
+
+ public Header getVersionHeader() {
+ return null;
+ }
+}
Propchange: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/IgnoreSpec.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/IgnoreSpec.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/IgnoreSpecFactory.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/IgnoreSpecFactory.java?rev=1042225&view=auto
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/IgnoreSpecFactory.java (added)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/IgnoreSpecFactory.java Sat Dec 4 19:01:02 2010
@@ -0,0 +1,47 @@
+/*
+ * ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ *
+ */
+
+package org.apache.http.impl.cookie;
+
+import org.apache.http.annotation.Immutable;
+import org.apache.http.cookie.CookieSpec;
+import org.apache.http.cookie.CookieSpecFactory;
+import org.apache.http.params.HttpParams;
+
+/**
+ * {@link CookieSpecFactory} implementation that ignores all cookies.
+ *
+ * @since 4.1
+ */
+@Immutable
+public class IgnoreSpecFactory implements CookieSpecFactory {
+
+ public CookieSpec newInstance(final HttpParams params) {
+ return new IgnoreSpec();
+ }
+
+}
Propchange: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/IgnoreSpecFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/IgnoreSpecFactory.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision