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:
parent
b71fefd093
commit
9996dad49d
|
@ -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.
|
||||||
|
|
|
@ -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);
|
||||||
|
|
|
@ -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());
|
||||||
|
|
Loading…
Reference in New Issue