Methods Summary |
---|
protected org.apache.http.auth.AuthSchemeRegistry | createAuthSchemeRegistry()
AuthSchemeRegistry registry = new AuthSchemeRegistry();
registry.register(
AuthPolicy.BASIC,
new BasicSchemeFactory());
registry.register(
AuthPolicy.DIGEST,
new DigestSchemeFactory());
return registry;
|
protected org.apache.http.conn.ClientConnectionManager | createClientConnectionManager()
SchemeRegistry registry = new SchemeRegistry();
registry.register(
new Scheme("http", PlainSocketFactory.getSocketFactory(), 80));
registry.register(
new Scheme("https", SSLSocketFactory.getSocketFactory(), 443));
ClientConnectionManager connManager = null;
HttpParams params = getParams();
ClientConnectionManagerFactory factory = null;
// Try first getting the factory directly as an object.
factory = (ClientConnectionManagerFactory) params
.getParameter(ClientPNames.CONNECTION_MANAGER_FACTORY);
if (factory == null) { // then try getting its class name.
String className = (String) params.getParameter(
ClientPNames.CONNECTION_MANAGER_FACTORY_CLASS_NAME);
if (className != null) {
try {
Class<?> clazz = Class.forName(className);
factory = (ClientConnectionManagerFactory) clazz.newInstance();
} catch (ClassNotFoundException ex) {
throw new IllegalStateException("Invalid class name: " + className);
} catch (IllegalAccessException ex) {
throw new IllegalAccessError(ex.getMessage());
} catch (InstantiationException ex) {
throw new InstantiationError(ex.getMessage());
}
}
}
if(factory != null) {
connManager = factory.newInstance(params, registry);
} else {
connManager = new SingleClientConnManager(getParams(), registry);
}
return connManager;
|
protected org.apache.http.conn.ConnectionKeepAliveStrategy | createConnectionKeepAliveStrategy()
return new DefaultConnectionKeepAliveStrategy();
|
protected org.apache.http.ConnectionReuseStrategy | createConnectionReuseStrategy()
return new DefaultConnectionReuseStrategy();
|
protected org.apache.http.cookie.CookieSpecRegistry | createCookieSpecRegistry()
CookieSpecRegistry registry = new CookieSpecRegistry();
registry.register(
CookiePolicy.BEST_MATCH,
new BestMatchSpecFactory());
registry.register(
CookiePolicy.BROWSER_COMPATIBILITY,
new BrowserCompatSpecFactory());
registry.register(
CookiePolicy.NETSCAPE,
new NetscapeDraftSpecFactory());
registry.register(
CookiePolicy.RFC_2109,
new RFC2109SpecFactory());
registry.register(
CookiePolicy.RFC_2965,
new RFC2965SpecFactory());
return registry;
|
protected org.apache.http.client.CookieStore | createCookieStore()
return new BasicCookieStore();
|
protected org.apache.http.client.CredentialsProvider | createCredentialsProvider()
return new BasicCredentialsProvider();
|
protected org.apache.http.protocol.HttpContext | createHttpContext()
HttpContext context = new BasicHttpContext();
context.setAttribute(
ClientContext.AUTHSCHEME_REGISTRY,
getAuthSchemes());
context.setAttribute(
ClientContext.COOKIESPEC_REGISTRY,
getCookieSpecs());
context.setAttribute(
ClientContext.COOKIE_STORE,
getCookieStore());
context.setAttribute(
ClientContext.CREDS_PROVIDER,
getCredentialsProvider());
return context;
|
protected org.apache.http.params.HttpParams | createHttpParams()
HttpParams params = new BasicHttpParams();
HttpProtocolParams.setVersion(params,
HttpVersion.HTTP_1_1);
HttpProtocolParams.setContentCharset(params,
HTTP.DEFAULT_CONTENT_CHARSET);
HttpProtocolParams.setUseExpectContinue(params,
true);
// determine the release version from packaged version info
final VersionInfo vi = VersionInfo.loadVersionInfo
("org.apache.http.client", getClass().getClassLoader());
final String release = (vi != null) ?
vi.getRelease() : VersionInfo.UNAVAILABLE;
HttpProtocolParams.setUserAgent(params,
"Apache-HttpClient/" + release + " (java 1.4)");
return params;
|
protected org.apache.http.protocol.BasicHttpProcessor | createHttpProcessor()
BasicHttpProcessor httpproc = new BasicHttpProcessor();
httpproc.addInterceptor(new RequestDefaultHeaders());
// Required protocol interceptors
httpproc.addInterceptor(new RequestContent());
httpproc.addInterceptor(new RequestTargetHost());
// Recommended protocol interceptors
httpproc.addInterceptor(new RequestConnControl());
httpproc.addInterceptor(new RequestUserAgent());
httpproc.addInterceptor(new RequestExpectContinue());
// HTTP state management interceptors
httpproc.addInterceptor(new RequestAddCookies());
httpproc.addInterceptor(new ResponseProcessCookies());
// HTTP authentication interceptors
httpproc.addInterceptor(new RequestTargetAuthentication());
httpproc.addInterceptor(new RequestProxyAuthentication());
return httpproc;
|
protected org.apache.http.client.HttpRequestRetryHandler | createHttpRequestRetryHandler()
return new DefaultHttpRequestRetryHandler();
|
protected org.apache.http.conn.routing.HttpRoutePlanner | createHttpRoutePlanner()
return new DefaultHttpRoutePlanner
(getConnectionManager().getSchemeRegistry());
|
protected org.apache.http.client.AuthenticationHandler | createProxyAuthenticationHandler()
return new DefaultProxyAuthenticationHandler();
|
protected org.apache.http.client.RedirectHandler | createRedirectHandler()
return new DefaultRedirectHandler();
|
protected org.apache.http.protocol.HttpRequestExecutor | createRequestExecutor()
return new HttpRequestExecutor();
|
protected org.apache.http.client.AuthenticationHandler | createTargetAuthenticationHandler()
return new DefaultTargetAuthenticationHandler();
|
protected org.apache.http.client.UserTokenHandler | createUserTokenHandler()
return new DefaultUserTokenHandler();
|