@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 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 |
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 java.lang.String |
legalurl |
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.impl.client.AbstractHttpClient |
sessionClient |
static java.lang.String |
SO_TIMEOUT |
static java.lang.String |
SSL |
static boolean |
TESTING |
static java.lang.String |
USER_AGENT |
| Constructor and Description |
|---|
HTTPSession() |
HTTPSession(java.lang.String url) |
| 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 static void |
defineCredentialsProvider(java.lang.String principal,
org.apache.http.auth.AuthScope scope,
org.apache.http.client.CredentialsProvider provider,
HTTPAuthStore store) |
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 java.util.List<org.apache.http.cookie.Cookie> |
getGlobalCookies() |
static ucar.httpservices.HTTPSession.Settings |
getGlobalSettings() |
static int |
getGlobalThreadCount() |
static java.lang.String |
getGlobalUserAgent() |
int |
getMethodcount() |
static int |
getRetryCount() |
ucar.httpservices.HTTPSession.Settings |
getSettings() |
java.lang.String |
getURL() |
static java.lang.String |
getUrlAsString(java.lang.String url) |
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 |
setAuthStore(HTTPAuthStore store) |
void |
setConnectionTimeout(int timeout) |
void |
setCredentials(java.lang.String scheme,
org.apache.http.auth.Credentials creds) |
void |
setCredentialsProvider(org.apache.http.auth.AuthScope scope,
org.apache.http.client.CredentialsProvider provider) |
void |
setCredentialsProvider(org.apache.http.client.CredentialsProvider provider) |
void |
setCredentialsProvider(java.lang.String surl) |
void |
setCredentialsProvider(java.lang.String scheme,
org.apache.http.client.CredentialsProvider provider) |
static void |
setGlobalCompression() |
static void |
setGlobalConnectionTimeout(int timeout) |
static void |
setGlobalCredentials(org.apache.http.auth.AuthScope scope,
org.apache.http.auth.Credentials creds) |
static void |
setGlobalCredentialsProvider(org.apache.http.auth.AuthScope scope,
org.apache.http.client.CredentialsProvider provider) |
static void |
setGlobalCredentialsProvider(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 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 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 java.lang.String legalurl
protected boolean closed
protected ucar.httpservices.HTTPSession.Settings localsettings
protected HTTPAuthStore authlocal
protected java.util.List<java.lang.Object> intercepts
public static boolean TESTING
public HTTPSession()
throws HTTPException
HTTPExceptionpublic HTTPSession(java.lang.String url)
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 java.util.List<org.apache.http.cookie.Cookie> getGlobalCookies()
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()
protected static void defineCredentialsProvider(java.lang.String principal,
org.apache.http.auth.AuthScope scope,
org.apache.http.client.CredentialsProvider provider,
HTTPAuthStore store)
public static void setGlobalCredentialsProvider(org.apache.http.auth.AuthScope scope,
org.apache.http.client.CredentialsProvider provider)
public static void setGlobalCredentialsProvider(org.apache.http.client.CredentialsProvider provider)
public static void setGlobalCredentials(org.apache.http.auth.AuthScope scope,
org.apache.http.auth.Credentials creds)
public 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
HTTPExceptionpublic HTTPAuthStore getAuthStore()
public void setAuthStore(HTTPAuthStore store)
public ucar.httpservices.HTTPSession.Settings getSettings()
public java.lang.String getURL()
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(org.apache.http.auth.AuthScope scope,
org.apache.http.client.CredentialsProvider provider)
public void setCredentialsProvider(org.apache.http.client.CredentialsProvider provider)
public void setCredentialsProvider(java.lang.String scheme,
org.apache.http.client.CredentialsProvider provider)
public void setCredentials(java.lang.String scheme,
org.apache.http.auth.Credentials creds)
public void setCredentialsProvider(java.lang.String surl)
throws HTTPException
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()