diff --git a/httpclient/src/main/java/org/apache/http/auth/AuthSchemeFactory.java b/httpclient/src/main/java/org/apache/http/auth/AuthSchemeFactory.java
index 0a43cb026..60a172434 100644
--- a/httpclient/src/main/java/org/apache/http/auth/AuthSchemeFactory.java
+++ b/httpclient/src/main/java/org/apache/http/auth/AuthSchemeFactory.java
@@ -33,7 +33,10 @@ import org.apache.http.params.HttpParams;
* Factory for {@link AuthScheme} implementations.
*
* @since 4.0
+ *
+ * @deprecated (4.3) use {@link AuthSchemeProvider}
*/
+@Deprecated
public interface AuthSchemeFactory {
/**
diff --git a/httpclient/src/main/java/org/apache/http/auth/AuthSchemeProvider.java b/httpclient/src/main/java/org/apache/http/auth/AuthSchemeProvider.java
new file mode 100644
index 000000000..572a8dd43
--- /dev/null
+++ b/httpclient/src/main/java/org/apache/http/auth/AuthSchemeProvider.java
@@ -0,0 +1,46 @@
+/*
+ * ====================================================================
+ * 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.auth;
+
+import org.apache.http.protocol.HttpContext;
+
+/**
+ * Factory for {@link AuthScheme} implementations.
+ *
+ * @since 4.3
+ */
+public interface AuthSchemeProvider {
+
+ /**
+ * Creates an instance of {@link AuthScheme}.
+ *
+ * @return auth scheme.
+ */
+ AuthScheme create(HttpContext context);
+
+}
diff --git a/httpclient/src/main/java/org/apache/http/auth/AuthSchemeRegistry.java b/httpclient/src/main/java/org/apache/http/auth/AuthSchemeRegistry.java
index 33f6350c9..24ca5acef 100644
--- a/httpclient/src/main/java/org/apache/http/auth/AuthSchemeRegistry.java
+++ b/httpclient/src/main/java/org/apache/http/auth/AuthSchemeRegistry.java
@@ -32,18 +32,26 @@ import java.util.Locale;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
+import org.apache.http.HttpRequest;
import org.apache.http.annotation.ThreadSafe;
+import org.apache.http.config.Lookup;
+import org.apache.http.config.Registry;
import org.apache.http.params.HttpParams;
+import org.apache.http.protocol.ExecutionContext;
+import org.apache.http.protocol.HttpContext;
/**
* Authentication scheme registry that can be used to obtain the corresponding
* authentication scheme implementation for a given type of authorization challenge.
*
* @since 4.0
+ *
+ * @deprecated (4.3) use {@link Registry}
*/
@ThreadSafe
-public final class AuthSchemeRegistry {
+@Deprecated
+public final class AuthSchemeRegistry implements Lookup {
private final ConcurrentHashMap registeredSchemes;
@@ -141,4 +149,16 @@ public final class AuthSchemeRegistry {
registeredSchemes.putAll(map);
}
+ public AuthSchemeProvider lookup(final String name) {
+ return new AuthSchemeProvider() {
+
+ public AuthScheme create(HttpContext context) {
+ HttpRequest request = (HttpRequest) context.getAttribute(
+ ExecutionContext.HTTP_REQUEST);
+ return getAuthScheme(name, request.getParams());
+ }
+
+ };
+ }
+
}
diff --git a/httpclient/src/main/java/org/apache/http/cookie/CookieSpecFactory.java b/httpclient/src/main/java/org/apache/http/cookie/CookieSpecFactory.java
index 55b322195..e27fa094f 100644
--- a/httpclient/src/main/java/org/apache/http/cookie/CookieSpecFactory.java
+++ b/httpclient/src/main/java/org/apache/http/cookie/CookieSpecFactory.java
@@ -33,7 +33,10 @@ import org.apache.http.params.HttpParams;
* Factory for {@link CookieSpec} implementations.
*
* @since 4.0
+ *
+ * @deprecated (4.3) use {@link CookieSpecProvider}
*/
+@Deprecated
public interface CookieSpecFactory {
/**
diff --git a/httpclient/src/main/java/org/apache/http/cookie/CookieSpecProvider.java b/httpclient/src/main/java/org/apache/http/cookie/CookieSpecProvider.java
new file mode 100644
index 000000000..fdb4f0279
--- /dev/null
+++ b/httpclient/src/main/java/org/apache/http/cookie/CookieSpecProvider.java
@@ -0,0 +1,46 @@
+/*
+ * ====================================================================
+ * 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.cookie;
+
+import org.apache.http.protocol.HttpContext;
+
+/**
+ * Factory for {@link CookieSpec} implementations.
+ *
+ * @since 4.3
+ */
+public interface CookieSpecProvider {
+
+ /**
+ * Creates an instance of {@link CookieSpec}.
+ *
+ * @return auth scheme.
+ */
+ CookieSpec create(HttpContext context);
+
+}
diff --git a/httpclient/src/main/java/org/apache/http/cookie/CookieSpecRegistry.java b/httpclient/src/main/java/org/apache/http/cookie/CookieSpecRegistry.java
index 72ef21914..bfb1085bf 100644
--- a/httpclient/src/main/java/org/apache/http/cookie/CookieSpecRegistry.java
+++ b/httpclient/src/main/java/org/apache/http/cookie/CookieSpecRegistry.java
@@ -33,19 +33,24 @@ import java.util.Locale;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
+import org.apache.http.HttpRequest;
import org.apache.http.annotation.ThreadSafe;
-
+import org.apache.http.config.Registry;
import org.apache.http.params.HttpParams;
+import org.apache.http.protocol.ExecutionContext;
+import org.apache.http.protocol.HttpContext;
/**
* Cookie specification registry that can be used to obtain the corresponding
* cookie specification implementation for a given type of type or version of
* cookie.
*
- *
* @since 4.0
+ *
+ * @deprecated (4.3) use {@link Registry}.
*/
@ThreadSafe
+@Deprecated
public final class CookieSpecRegistry {
private final ConcurrentHashMap registeredSpecs;
@@ -154,4 +159,16 @@ public final class CookieSpecRegistry {
registeredSpecs.putAll(map);
}
+ public CookieSpecProvider lookup(final String name) {
+ return new CookieSpecProvider() {
+
+ public CookieSpec create(HttpContext context) {
+ HttpRequest request = (HttpRequest) context.getAttribute(
+ ExecutionContext.HTTP_REQUEST);
+ return getCookieSpec(name, request.getParams());
+ }
+
+ };
+ }
+
}