From 9996dad49dd50145cfdce1c3679125691d496072 Mon Sep 17 00:00:00 2001 From: Oleg Kalnichevski Date: Tue, 2 Jun 2009 16:18:12 +0000 Subject: [PATCH] Follow-up to HTTPCLIENT-853 git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@781075 13f79535-47bb-0310-9956-ffa450edef68 --- .../java/org/apache/http/client/protocol/ClientContext.java | 5 +++++ .../org/apache/http/client/protocol/RequestAddCookies.java | 2 +- .../java/org/apache/http/impl/client/DefaultHttpClient.java | 3 +++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/httpclient/src/main/java/org/apache/http/client/protocol/ClientContext.java b/httpclient/src/main/java/org/apache/http/client/protocol/ClientContext.java index 1ae1213fc..8c0a336ba 100644 --- a/httpclient/src/main/java/org/apache/http/client/protocol/ClientContext.java +++ b/httpclient/src/main/java/org/apache/http/client/protocol/ClientContext.java @@ -39,6 +39,11 @@ package org.apache.http.client.protocol; */ public interface ClientContext { + /** + * Attribute name of a {@link org.apache.http.conn.scheme.Scheme} + * object that represents the actual protocol scheme registry. + */ + public static final String SCHEME_REGISTRY = "http.scheme-registry"; /** * Attribute name of a {@link org.apache.http.cookie.CookieSpecRegistry} * object that represents the actual cookie specification registry. diff --git a/httpclient/src/main/java/org/apache/http/client/protocol/RequestAddCookies.java b/httpclient/src/main/java/org/apache/http/client/protocol/RequestAddCookies.java index d0ff128f4..dae34fec5 100644 --- a/httpclient/src/main/java/org/apache/http/client/protocol/RequestAddCookies.java +++ b/httpclient/src/main/java/org/apache/http/client/protocol/RequestAddCookies.java @@ -152,7 +152,7 @@ public class RequestAddCookies implements HttpRequestInterceptor { // Obtain the scheme registry SchemeRegistry sr = (SchemeRegistry) context.getAttribute( - ClientContext.AUTHSCHEME_REGISTRY); + ClientContext.SCHEME_REGISTRY); if (sr != null) { Scheme scheme = sr.get(targetHost.getSchemeName()); port = scheme.resolvePort(port); diff --git a/httpclient/src/main/java/org/apache/http/impl/client/DefaultHttpClient.java b/httpclient/src/main/java/org/apache/http/impl/client/DefaultHttpClient.java index f7e4fbfce..7e086b6ca 100644 --- a/httpclient/src/main/java/org/apache/http/impl/client/DefaultHttpClient.java +++ b/httpclient/src/main/java/org/apache/http/impl/client/DefaultHttpClient.java @@ -209,6 +209,9 @@ public class DefaultHttpClient extends AbstractHttpClient { @Override protected HttpContext createHttpContext() { HttpContext context = new BasicHttpContext(); + context.setAttribute( + ClientContext.SCHEME_REGISTRY, + getConnectionManager().getSchemeRegistry()); context.setAttribute( ClientContext.AUTHSCHEME_REGISTRY, getAuthSchemes());