@NotThreadSafe
public class HTTPSession
extends java.lang.Object
implements java.lang.AutoCloseable
| Modifier and Type | Class and Description |
|---|---|
static class |
HTTPSession.RetryHandler |
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
ACCEPT_ENCODING |
static java.lang.String |
ALLOW_CIRCULAR_REDIRECTS |
protected static HTTPAuthStore |
authglobal |
protected HTTPAuthStore |
authlocal |
static java.lang.String |
BASIC |
protected boolean |
closed |
static java.lang.String |
COMPRESSION |
static java.lang.String |
CONN_TIMEOUT |
static java.lang.String |
CREDENTIALS |
static java.lang.String |
DIGEST |
protected org.apache.http.protocol.HttpContext |
execcontext |
static java.lang.String |
HANDLE_AUTHENTICATION |
static java.lang.String |
HANDLE_REDIRECTS |
static java.lang.String |
HEADER_USERAGENT |
protected java.lang.String |
identifier |
protected java.util.List<java.lang.Object> |
intercepts |
protected ucar.httpservices.HTTPSession.Settings |
localsettings |
static org.slf4j.Logger |
log |
static java.lang.String |
MAX_REDIRECTS |
protected java.util.List<HTTPMethod> |
methodList |
static java.lang.String |
NTLM |
static java.lang.String |
PROXY |
protected org.apache.http.auth.AuthScope |
realm |
protected java.lang.String |
realmURL |
protected org.apache.http.impl.client.AbstractHttpClient |
sessionClient |
protected java.lang.String |
sessionURL |
static java.lang.String |
SO_TIMEOUT |
static java.lang.String |
SSL |
static boolean |
TESTING |
static java.lang.String |
USER_AGENT |
| Modifier | Constructor and Description |
|---|---|
protected |
HTTPSession() |
|
HTTPSession(org.apache.http.auth.AuthScope scope) |
|
HTTPSession(java.lang.String url) |
|
HTTPSession(java.lang.String host,
int port) |
| Modifier and Type | Method and Description |
|---|---|
static java.lang.String |
canonicalpath(java.lang.String path)
Convert path to use '/' consistently and
to remove any trailing '/'
|
void |
clearState() |
void |
close()
Close the session.
|
static void |
debugHeaders(boolean print) |
static HTTPUtil.InterceptRequest |
debugRequestInterceptor() |
static void |
debugReset() |
static HTTPUtil.InterceptResponse |
debugResponseInterceptor() |
protected org.apache.http.HttpResponse |
execute(org.apache.http.client.methods.HttpRequestBase request) |
HTTPAuthStore |
getAuthStore() |
static java.lang.String |
getCanonicalURL(java.lang.String legalurl) |
java.util.List<org.apache.http.cookie.Cookie> |
getCookies() |
static ucar.httpservices.HTTPSession.Settings |
getGlobalSettings() |
static int |
getGlobalThreadCount() |
static java.lang.String |
getGlobalUserAgent() |
int |
getMethodcount() |
org.apache.http.auth.AuthScope |
getRealm() |
static int |
getRetryCount() |
java.lang.String |
getSessionURL() |
ucar.httpservices.HTTPSession.Settings |
getSettings() |
static java.lang.String |
getUrlAsString(java.lang.String url) |
protected void |
init(org.apache.http.auth.AuthScope scope) |
boolean |
isClosed() |
protected static void |
kill() |
static int |
putUrlAsString(java.lang.String content,
java.lang.String url) |
static java.lang.String |
removeprincipal(java.lang.String u) |
protected void |
setAuthentication(HTTPCachingProvider hap) |
void |
setConnectionTimeout(int timeout) |
void |
setCredentials(java.lang.String url,
org.apache.http.auth.Credentials creds)
It is convenient to be able to directly set the Credentials
(not the provider) when those credentials are fixed.
|
void |
setCredentialsProvider(org.apache.http.auth.AuthScope scope,
org.apache.http.client.CredentialsProvider provider) |
void |
setCredentialsProvider(java.lang.String url,
org.apache.http.client.CredentialsProvider provider) |
static void |
setGlobalCompression() |
static void |
setGlobalConnectionTimeout(int timeout) |
static void |
setGlobalCredentials(java.lang.String url,
org.apache.http.auth.Credentials creds)
It is convenient to be able to directly set the Credentials
(not the provider) when those credentials are fixed.
|
static void |
setGlobalCredentialsProvider(org.apache.http.auth.AuthScope scope,
org.apache.http.client.CredentialsProvider provider) |
static void |
setGlobalCredentialsProvider(org.apache.http.client.CredentialsProvider provider,
java.lang.String scheme) |
static void |
setGlobalCredentialsProvider(java.lang.String url,
org.apache.http.client.CredentialsProvider provider) |
static void |
setGlobalMaxConnections(int nthreads) |
static void |
setGlobalProxy(java.lang.String host,
int port) |
static void |
setGlobalSoTimeout(int timeout) |
static void |
setGlobalThreadCount(int nthreads) |
static void |
setGlobalUserAgent(java.lang.String userAgent) |
void |
setMaxRedirects(int n) |
void |
setProxy(java.lang.String host,
int port) |
static void |
setRetryCount(int count) |
void |
setSoTimeout(int timeout) |
void |
setUserAgent(java.lang.String agent) |
protected static void |
track(HTTPSession session) |
public static final java.lang.String ALLOW_CIRCULAR_REDIRECTS
public static final java.lang.String HANDLE_REDIRECTS
public static final java.lang.String HANDLE_AUTHENTICATION
public static final java.lang.String MAX_REDIRECTS
public static final java.lang.String SO_TIMEOUT
public static final java.lang.String CONN_TIMEOUT
public static final java.lang.String USER_AGENT
public static final java.lang.String PROXY
public static final java.lang.String COMPRESSION
public static final java.lang.String HEADER_USERAGENT
public static final java.lang.String ACCEPT_ENCODING
public static final java.lang.String CREDENTIALS
public static final java.lang.String BASIC
public static final java.lang.String DIGEST
public static final java.lang.String NTLM
public static final java.lang.String SSL
public static org.slf4j.Logger log
protected static HTTPAuthStore authglobal
protected java.lang.String sessionURL
protected org.apache.http.auth.AuthScope realm
protected java.lang.String realmURL
protected boolean closed
protected org.apache.http.impl.client.AbstractHttpClient sessionClient
protected java.util.List<HTTPMethod> methodList
protected org.apache.http.protocol.HttpContext execcontext
protected java.lang.String identifier
protected ucar.httpservices.HTTPSession.Settings localsettings
protected HTTPAuthStore authlocal
protected java.util.List<java.lang.Object> intercepts
public static boolean TESTING
protected HTTPSession()
throws HTTPException
HTTPExceptionpublic HTTPSession(java.lang.String host,
int port)
throws HTTPException
HTTPExceptionpublic HTTPSession(java.lang.String url)
throws HTTPException
HTTPExceptionpublic HTTPSession(org.apache.http.auth.AuthScope scope)
throws HTTPException
HTTPExceptionpublic static ucar.httpservices.HTTPSession.Settings getGlobalSettings()
public static void setGlobalUserAgent(java.lang.String userAgent)
public static java.lang.String getGlobalUserAgent()
public static void setGlobalThreadCount(int nthreads)
public static void setGlobalMaxConnections(int nthreads)
public static int getGlobalThreadCount()
public static void setGlobalConnectionTimeout(int timeout)
public static void setGlobalSoTimeout(int timeout)
public static void setGlobalProxy(java.lang.String host,
int port)
public static void setGlobalCompression()
public static void setGlobalCredentialsProvider(java.lang.String url,
org.apache.http.client.CredentialsProvider provider)
throws HTTPException
url - provider - HTTPExceptionpublic static void setGlobalCredentialsProvider(org.apache.http.client.CredentialsProvider provider,
java.lang.String scheme)
throws HTTPException
url - provider - HTTPExceptionpublic static void setGlobalCredentialsProvider(org.apache.http.auth.AuthScope scope,
org.apache.http.client.CredentialsProvider provider)
throws HTTPException
HTTPExceptionpublic static void setGlobalCredentials(java.lang.String url,
org.apache.http.auth.Credentials creds)
throws HTTPException
url - creds - HTTPExceptionpublic static int getRetryCount()
public static void setRetryCount(int count)
public static java.lang.String getCanonicalURL(java.lang.String legalurl)
public static java.lang.String canonicalpath(java.lang.String path)
path - convert this pathpublic static java.lang.String removeprincipal(java.lang.String u)
public static java.lang.String getUrlAsString(java.lang.String url)
throws HTTPException
HTTPExceptionpublic static int putUrlAsString(java.lang.String content,
java.lang.String url)
throws HTTPException
HTTPExceptionprotected void init(org.apache.http.auth.AuthScope scope)
throws HTTPException
HTTPExceptionpublic HTTPAuthStore getAuthStore()
public ucar.httpservices.HTTPSession.Settings getSettings()
public org.apache.http.auth.AuthScope getRealm()
public java.lang.String getSessionURL()
public void setUserAgent(java.lang.String agent)
public void setSoTimeout(int timeout)
public void setConnectionTimeout(int timeout)
public void setMaxRedirects(int n)
public void close()
close in interface java.lang.AutoCloseablepublic java.util.List<org.apache.http.cookie.Cookie> getCookies()
public void clearState()
public void setProxy(java.lang.String host,
int port)
public void setCredentialsProvider(java.lang.String url,
org.apache.http.client.CredentialsProvider provider)
throws HTTPException
url - provider - HTTPExceptionpublic void setCredentialsProvider(org.apache.http.auth.AuthScope scope,
org.apache.http.client.CredentialsProvider provider)
throws HTTPException
HTTPExceptionpublic void setCredentials(java.lang.String url,
org.apache.http.auth.Credentials creds)
throws HTTPException
url - creds - HTTPExceptionprotected void setAuthentication(HTTPCachingProvider hap)
protected org.apache.http.HttpResponse execute(org.apache.http.client.methods.HttpRequestBase request)
throws java.io.IOException
java.io.IOExceptionpublic boolean isClosed()
public int getMethodcount()
protected static void kill()
protected static void track(HTTPSession session)
public static void debugHeaders(boolean print)
public static void debugReset()
public static HTTPUtil.InterceptRequest debugRequestInterceptor()
public static HTTPUtil.InterceptResponse debugResponseInterceptor()