diff --git a/httpclient/src/main/java/org/apache/http/client/URICollection.java b/httpclient/src/main/java/org/apache/http/client/URICollection.java
deleted file mode 100644
index 39c439e87..000000000
--- a/httpclient/src/main/java/org/apache/http/client/URICollection.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * ====================================================================
- * 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
- * .
- *
- */
-
-package org.apache.http.client;
-
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import org.apache.http.annotation.NotThreadSafe;
-
-/**
- * This class represents an iterable collection of {@link URI}s.
- *
- * @since 4.3
- */
-@NotThreadSafe // HashSet is not synch.
-public class URICollection implements Iterable {
-
- private final Set unique;
- private final List all;
-
- public URICollection() {
- super();
- this.unique = new HashSet();
- this.all = new ArrayList();
- }
-
- /**
- * Test if the URI is present in the collection.
- */
- public boolean contains(final URI uri) {
- return this.unique.contains(uri);
- }
-
- /**
- * Adds a new URI to the collection.
- */
- public void add(final URI uri) {
- this.unique.add(uri);
- this.all.add(uri);
- }
-
- /**
- * Removes a URI from the collection.
- */
- public boolean remove(final URI uri) {
- final boolean removed = this.unique.remove(uri);
- if (removed) {
- final Iterator it = this.all.iterator();
- while (it.hasNext()) {
- final URI current = it.next();
- if (current.equals(uri)) {
- it.remove();
- }
- }
- }
- return removed;
- }
-
- public List getAll() {
- return new ArrayList(this.all);
- }
-
- public Set getUnique() {
- return new HashSet(this.unique);
- }
-
- public Iterator iterator() {
- return getAll().iterator();
- }
-
- public int getCount() {
- return this.all.size();
- }
-
- public boolean isEmpty() {
- return this.all.isEmpty();
- }
-
- public void clear() {
- this.all.clear();
- this.unique.clear();
- }
-
-}
diff --git a/httpclient/src/main/java/org/apache/http/client/protocol/HttpClientContext.java b/httpclient/src/main/java/org/apache/http/client/protocol/HttpClientContext.java
index fe892c46f..53e1eefda 100644
--- a/httpclient/src/main/java/org/apache/http/client/protocol/HttpClientContext.java
+++ b/httpclient/src/main/java/org/apache/http/client/protocol/HttpClientContext.java
@@ -27,13 +27,15 @@
package org.apache.http.client.protocol;
+import java.net.URI;
+import java.util.List;
+
import org.apache.http.annotation.NotThreadSafe;
import org.apache.http.auth.AuthSchemeProvider;
import org.apache.http.auth.AuthState;
import org.apache.http.client.AuthCache;
import org.apache.http.client.CookieStore;
import org.apache.http.client.CredentialsProvider;
-import org.apache.http.client.URICollection;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.config.Lookup;
import org.apache.http.conn.routing.HttpRoute;
@@ -61,9 +63,8 @@ public class HttpClientContext extends HttpCoreContext {
public static final String HTTP_ROUTE = "http.route";
/**
- * Attribute name of a {@link org.apache.http.client.URICollection} object that
- * represents a collection of all redirect locations received in the process
- * of request execution.
+ * Attribute name of a {@link List} object that represents a collection of all
+ * redirect locations received in the process of request execution.
*/
public static final String REDIRECT_LOCATIONS = "http.protocol.redirect-locations";
@@ -157,8 +158,9 @@ public class HttpClientContext extends HttpCoreContext {
return getAttribute(HTTP_ROUTE, HttpRoute.class);
}
- public URICollection getRedirectLocations() {
- return getAttribute(REDIRECT_LOCATIONS, URICollection.class);
+ @SuppressWarnings("unchecked") // type parameter
+ public List getRedirectLocations() {
+ return getAttribute(REDIRECT_LOCATIONS, List.class);
}
public CookieStore getCookieStore() {
diff --git a/httpclient/src/main/java/org/apache/http/impl/client/RedirectLocations.java b/httpclient/src/main/java/org/apache/http/impl/client/RedirectLocations.java
index 8ba975066..9f1484220 100644
--- a/httpclient/src/main/java/org/apache/http/impl/client/RedirectLocations.java
+++ b/httpclient/src/main/java/org/apache/http/impl/client/RedirectLocations.java
@@ -27,8 +27,15 @@
package org.apache.http.impl.client;
+import java.net.URI;
+import java.util.AbstractList;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
import org.apache.http.annotation.NotThreadSafe;
-import org.apache.http.client.URICollection;
/**
* This class represents a collection of {@link java.net.URI}s used
@@ -36,6 +43,185 @@ import org.apache.http.client.URICollection;
*
* @since 4.0
*/
-@NotThreadSafe
-public class RedirectLocations extends URICollection {
+@NotThreadSafe // HashSet/ArrayList are not synch.
+public class RedirectLocations extends AbstractList