Follow-up to HTTPCLIENT-853

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@781075 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Oleg Kalnichevski 2009-06-02 16:18:12 +00:00
parent b71fefd093
commit 9996dad49d
3 changed files with 9 additions and 1 deletions

View File

@ -39,6 +39,11 @@ package org.apache.http.client.protocol;
*/ */
public interface ClientContext { 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} * Attribute name of a {@link org.apache.http.cookie.CookieSpecRegistry}
* object that represents the actual cookie specification registry. * object that represents the actual cookie specification registry.

View File

@ -152,7 +152,7 @@ public class RequestAddCookies implements HttpRequestInterceptor {
// Obtain the scheme registry // Obtain the scheme registry
SchemeRegistry sr = (SchemeRegistry) context.getAttribute( SchemeRegistry sr = (SchemeRegistry) context.getAttribute(
ClientContext.AUTHSCHEME_REGISTRY); ClientContext.SCHEME_REGISTRY);
if (sr != null) { if (sr != null) {
Scheme scheme = sr.get(targetHost.getSchemeName()); Scheme scheme = sr.get(targetHost.getSchemeName());
port = scheme.resolvePort(port); port = scheme.resolvePort(port);

View File

@ -209,6 +209,9 @@ public class DefaultHttpClient extends AbstractHttpClient {
@Override @Override
protected HttpContext createHttpContext() { protected HttpContext createHttpContext() {
HttpContext context = new BasicHttpContext(); HttpContext context = new BasicHttpContext();
context.setAttribute(
ClientContext.SCHEME_REGISTRY,
getConnectionManager().getSchemeRegistry());
context.setAttribute( context.setAttribute(
ClientContext.AUTHSCHEME_REGISTRY, ClientContext.AUTHSCHEME_REGISTRY,
getAuthSchemes()); getAuthSchemes());