adapted examples to HTTPCORE-100, updated release notes
git-svn-id: https://svn.apache.org/repos/asf/jakarta/httpcomponents/httpclient/trunk@558121 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
fd53851031
commit
826d674e3d
|
@ -1,5 +1,8 @@
|
||||||
Changes since release 4.0 Alpha 1
|
Changes since release 4.0 Alpha 1
|
||||||
|
|
||||||
|
* [HTTPCORE-100] revised HttpContext hierarchy
|
||||||
|
Contributed by Roland Weber <rolandw at apache.org>
|
||||||
|
|
||||||
* [HTTPCLIENT-618] eliminate class HostConfiguration
|
* [HTTPCLIENT-618] eliminate class HostConfiguration
|
||||||
Contributed by Roland Weber <rolandw at apache.org>
|
Contributed by Roland Weber <rolandw at apache.org>
|
||||||
|
|
||||||
|
|
|
@ -36,10 +36,12 @@ import org.apache.http.HttpResponse;
|
||||||
import org.apache.http.client.HttpClient;
|
import org.apache.http.client.HttpClient;
|
||||||
import org.apache.http.client.HttpState;
|
import org.apache.http.client.HttpState;
|
||||||
import org.apache.http.client.methods.HttpGet;
|
import org.apache.http.client.methods.HttpGet;
|
||||||
import org.apache.http.client.protocol.HttpClientContext;
|
import org.apache.http.client.protocol.ClientContext;
|
||||||
import org.apache.http.cookie.Cookie;
|
import org.apache.http.cookie.Cookie;
|
||||||
import org.apache.http.impl.client.DefaultHttpClient;
|
import org.apache.http.impl.client.DefaultHttpClient;
|
||||||
import org.apache.http.protocol.HttpContext;
|
import org.apache.http.protocol.HttpContext;
|
||||||
|
import org.apache.http.protocol.BasicHttpContext;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This example demonstrates the use of a local HTTP context populated with
|
* This example demonstrates the use of a local HTTP context populated with
|
||||||
|
@ -57,9 +59,9 @@ public class ClientCustomContext {
|
||||||
// Obtain default HTTP context
|
// Obtain default HTTP context
|
||||||
HttpContext defaultContext = httpclient.getDefaultContext();
|
HttpContext defaultContext = httpclient.getDefaultContext();
|
||||||
// Create local HTTP context
|
// Create local HTTP context
|
||||||
HttpContext localContext = new HttpClientContext(defaultContext);
|
HttpContext localContext = new BasicHttpContext(defaultContext);
|
||||||
// Bind custom HTTP state to the local context
|
// Bind custom HTTP state to the local context
|
||||||
localContext.setAttribute(HttpClientContext.HTTP_STATE, localState);
|
localContext.setAttribute(ClientContext.HTTP_STATE, localState);
|
||||||
|
|
||||||
HttpGet httpget = new HttpGet("http://www.google.com/");
|
HttpGet httpget = new HttpGet("http://www.google.com/");
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,6 @@ import org.apache.http.HttpResponse;
|
||||||
import org.apache.http.HttpVersion;
|
import org.apache.http.HttpVersion;
|
||||||
import org.apache.http.client.HttpClient;
|
import org.apache.http.client.HttpClient;
|
||||||
import org.apache.http.client.methods.HttpGet;
|
import org.apache.http.client.methods.HttpGet;
|
||||||
import org.apache.http.client.protocol.HttpClientContext;
|
|
||||||
import org.apache.http.conn.ClientConnectionManager;
|
import org.apache.http.conn.ClientConnectionManager;
|
||||||
import org.apache.http.conn.PlainSocketFactory;
|
import org.apache.http.conn.PlainSocketFactory;
|
||||||
import org.apache.http.conn.Scheme;
|
import org.apache.http.conn.Scheme;
|
||||||
|
@ -48,6 +47,7 @@ import org.apache.http.params.BasicHttpParams;
|
||||||
import org.apache.http.params.HttpParams;
|
import org.apache.http.params.HttpParams;
|
||||||
import org.apache.http.params.HttpProtocolParams;
|
import org.apache.http.params.HttpProtocolParams;
|
||||||
import org.apache.http.protocol.HttpContext;
|
import org.apache.http.protocol.HttpContext;
|
||||||
|
import org.apache.http.protocol.BasicHttpContext;
|
||||||
import org.apache.http.util.EntityUtils;
|
import org.apache.http.util.EntityUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -110,7 +110,7 @@ public class ClientMultiThreadedExecution {
|
||||||
|
|
||||||
public GetThread(HttpClient httpClient, HttpGet httpget, int id) {
|
public GetThread(HttpClient httpClient, HttpGet httpget, int id) {
|
||||||
this.httpClient = httpClient;
|
this.httpClient = httpClient;
|
||||||
this.context = new HttpClientContext(httpClient.getDefaultContext());
|
this.context = new BasicHttpContext(httpClient.getDefaultContext());
|
||||||
this.httpget = httpget;
|
this.httpget = httpget;
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,7 +50,7 @@ import org.apache.http.params.BasicHttpParams;
|
||||||
import org.apache.http.params.HttpParams;
|
import org.apache.http.params.HttpParams;
|
||||||
import org.apache.http.params.HttpProtocolParams;
|
import org.apache.http.params.HttpProtocolParams;
|
||||||
import org.apache.http.protocol.HttpContext;
|
import org.apache.http.protocol.HttpContext;
|
||||||
import org.apache.http.protocol.HttpExecutionContext;
|
import org.apache.http.protocol.BasicHttpContext;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -211,7 +211,7 @@ public class ManagerConnectDirect {
|
||||||
* @return a new, empty context
|
* @return a new, empty context
|
||||||
*/
|
*/
|
||||||
private final static HttpContext createContext() {
|
private final static HttpContext createContext() {
|
||||||
return new HttpExecutionContext(null);
|
return new BasicHttpContext(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // class ManagerConnectDirect
|
} // class ManagerConnectDirect
|
||||||
|
|
|
@ -51,7 +51,7 @@ import org.apache.http.params.BasicHttpParams;
|
||||||
import org.apache.http.params.HttpParams;
|
import org.apache.http.params.HttpParams;
|
||||||
import org.apache.http.params.HttpProtocolParams;
|
import org.apache.http.params.HttpProtocolParams;
|
||||||
import org.apache.http.protocol.HttpContext;
|
import org.apache.http.protocol.HttpContext;
|
||||||
import org.apache.http.protocol.HttpExecutionContext;
|
import org.apache.http.protocol.BasicHttpContext;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -264,7 +264,7 @@ public class ManagerConnectProxy {
|
||||||
* @return a new, empty context
|
* @return a new, empty context
|
||||||
*/
|
*/
|
||||||
private final static HttpContext createContext() {
|
private final static HttpContext createContext() {
|
||||||
return new HttpExecutionContext(null);
|
return new BasicHttpContext(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,7 @@ import org.apache.http.params.BasicHttpParams;
|
||||||
import org.apache.http.params.HttpParams;
|
import org.apache.http.params.HttpParams;
|
||||||
import org.apache.http.params.HttpProtocolParams;
|
import org.apache.http.params.HttpProtocolParams;
|
||||||
import org.apache.http.protocol.HttpContext;
|
import org.apache.http.protocol.HttpContext;
|
||||||
import org.apache.http.protocol.HttpExecutionContext;
|
import org.apache.http.protocol.BasicHttpContext;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -188,7 +188,7 @@ public class OperatorConnectDirect {
|
||||||
* @return a new, empty context
|
* @return a new, empty context
|
||||||
*/
|
*/
|
||||||
private final static HttpContext createContext() {
|
private final static HttpContext createContext() {
|
||||||
return new HttpExecutionContext(null);
|
return new BasicHttpContext(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // class OperatorConnectDirect
|
} // class OperatorConnectDirect
|
||||||
|
|
|
@ -50,7 +50,7 @@ import org.apache.http.params.BasicHttpParams;
|
||||||
import org.apache.http.params.HttpParams;
|
import org.apache.http.params.HttpParams;
|
||||||
import org.apache.http.params.HttpProtocolParams;
|
import org.apache.http.params.HttpProtocolParams;
|
||||||
import org.apache.http.protocol.HttpContext;
|
import org.apache.http.protocol.HttpContext;
|
||||||
import org.apache.http.protocol.HttpExecutionContext;
|
import org.apache.http.protocol.BasicHttpContext;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -245,7 +245,7 @@ public class OperatorConnectProxy {
|
||||||
* @return a new, empty context
|
* @return a new, empty context
|
||||||
*/
|
*/
|
||||||
private final static HttpContext createContext() {
|
private final static HttpContext createContext() {
|
||||||
return new HttpExecutionContext(null);
|
return new BasicHttpContext(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue