@NotThreadSafe public class HTTPSession extends Object implements AutoCloseable
Modifier and Type | Class and Description |
---|---|
static class |
HTTPSession.RetryHandler |
Modifier and Type | Field and Description |
---|---|
static String |
ACCEPT_ENCODING |
static String |
ALLOW_CIRCULAR_REDIRECTS |
protected HTTPAuthStore |
authlocal |
static String |
BASIC |
protected boolean |
closed |
static String |
COMPRESSION |
static String |
CONN_TIMEOUT |
static String |
DIGEST |
protected org.apache.http.protocol.HttpContext |
execcontext |
static String |
HANDLE_AUTHENTICATION |
static String |
HANDLE_REDIRECTS |
static String |
HEADER_USERAGENT |
protected String |
identifier |
protected List<Object> |
intercepts |
protected String |
legalurl |
protected ucar.httpservices.HTTPSession.Settings |
localsettings |
static org.slf4j.Logger |
log |
static String |
MAX_REDIRECTS |
protected List<HTTPMethod> |
methodList |
static String |
NTLM |
static String |
PROXY |
protected org.apache.http.impl.client.AbstractHttpClient |
sessionClient |
static String |
SO_TIMEOUT |
static String |
SSL |
static boolean |
TESTING |
static String |
USER_AGENT |
Constructor and Description |
---|
HTTPSession() |
HTTPSession(String url) |
Modifier and Type | Method and Description |
---|---|
static String |
canonicalpath(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(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 String |
getCanonicalURL(String legalurl) |
List<org.apache.http.cookie.Cookie> |
getCookies() |
static List<org.apache.http.cookie.Cookie> |
getGlobalCookies() |
static ucar.httpservices.HTTPSession.Settings |
getGlobalSettings() |
static int |
getGlobalThreadCount() |
static String |
getGlobalUserAgent() |
int |
getMethodcount() |
static int |
getRetryCount() |
ucar.httpservices.HTTPSession.Settings |
getSettings() |
String |
getURL() |
static String |
getUrlAsString(String url) |
boolean |
isClosed() |
protected static void |
kill() |
static int |
putUrlAsString(String content,
String url) |
static String |
removeprincipal(String u) |
protected void |
setAuthentication(HTTPCachingProvider hap) |
void |
setAuthStore(HTTPAuthStore store) |
void |
setConnectionTimeout(int timeout) |
void |
setCredentials(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(String surl) |
void |
setCredentialsProvider(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(String host,
int port) |
static void |
setGlobalSoTimeout(int timeout) |
static void |
setGlobalThreadCount(int nthreads) |
static void |
setGlobalUserAgent(String userAgent) |
void |
setMaxRedirects(int n) |
void |
setProxy(String host,
int port) |
static void |
setRetryCount(int count) |
void |
setSoTimeout(int timeout) |
void |
setUserAgent(String agent) |
protected static void |
track(HTTPSession session) |
public static final String ALLOW_CIRCULAR_REDIRECTS
public static final String HANDLE_REDIRECTS
public static final String HANDLE_AUTHENTICATION
public static final String MAX_REDIRECTS
public static final String SO_TIMEOUT
public static final String CONN_TIMEOUT
public static final String USER_AGENT
public static final String PROXY
public static final String COMPRESSION
public static final String HEADER_USERAGENT
public static final String ACCEPT_ENCODING
public static final String BASIC
public static final String DIGEST
public static final String NTLM
public static final String SSL
public static org.slf4j.Logger log
protected org.apache.http.impl.client.AbstractHttpClient sessionClient
protected List<HTTPMethod> methodList
protected org.apache.http.protocol.HttpContext execcontext
protected String identifier
protected String legalurl
protected boolean closed
protected ucar.httpservices.HTTPSession.Settings localsettings
protected HTTPAuthStore authlocal
public static boolean TESTING
public HTTPSession() throws HTTPException
HTTPException
public HTTPSession(String url) throws HTTPException
HTTPException
public static ucar.httpservices.HTTPSession.Settings getGlobalSettings()
public static void setGlobalUserAgent(String userAgent)
public static String getGlobalUserAgent()
public static void setGlobalThreadCount(int nthreads)
public static void setGlobalMaxConnections(int nthreads)
public static int getGlobalThreadCount()
public static List<org.apache.http.cookie.Cookie> getGlobalCookies()
public static void setGlobalConnectionTimeout(int timeout)
public static void setGlobalSoTimeout(int timeout)
public static void setGlobalProxy(String host, int port)
public static void setGlobalCompression()
protected static void defineCredentialsProvider(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 String canonicalpath(String path)
path
- convert this pathpublic static String getUrlAsString(String url) throws HTTPException
HTTPException
public static int putUrlAsString(String content, String url) throws HTTPException
HTTPException
public HTTPAuthStore getAuthStore()
public void setAuthStore(HTTPAuthStore store)
public ucar.httpservices.HTTPSession.Settings getSettings()
public String getURL()
public void setUserAgent(String agent)
public void setSoTimeout(int timeout)
public void setConnectionTimeout(int timeout)
public void setMaxRedirects(int n)
public void close()
close
in interface AutoCloseable
public List<org.apache.http.cookie.Cookie> getCookies()
public void clearState()
public void setProxy(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(String scheme, org.apache.http.client.CredentialsProvider provider)
public void setCredentials(String scheme, org.apache.http.auth.Credentials creds)
public void setCredentialsProvider(String surl) throws HTTPException
HTTPException
protected void setAuthentication(HTTPCachingProvider hap)
protected org.apache.http.HttpResponse execute(org.apache.http.client.methods.HttpRequestBase request) throws IOException
IOException
public 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()
Copyright © 1999–2018 UCAR/Unidata. All rights reserved.