public final class HttpUtil
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
protected static java.util.logging.Logger |
loggerUrl
this logger is for opening connections to remote sites.
|
| Constructor and Description |
|---|
HttpUtil() |
| Modifier and Type | Method and Description |
|---|---|
static java.net.URLConnection |
checkRedirect(java.net.URLConnection urlConnection)
check for 301, 302 or 303 redirects, and return a new connection in this case.
|
static void |
consumeStream(java.io.InputStream err)
nice clients consume both the stderr and stdout coming from websites.
|
static java.util.Map<java.lang.String,java.lang.String> |
getMetadata(java.net.URL url,
java.util.Map<java.lang.String,java.lang.String> props)
return the metadata about a URL.
|
protected static final java.util.logging.Logger loggerUrl
public static void consumeStream(java.io.InputStream err)
throws java.io.IOException
err - the input streamjava.io.IOExceptionpublic static java.util.Map<java.lang.String,java.lang.String> getMetadata(java.net.URL url,
java.util.Map<java.lang.String,java.lang.String> props)
throws java.io.IOException
url - ftp,https, or http URLprops - if non-null, may be a map containing cookie.java.io.IOException - when HEAD requests are made.public static java.net.URLConnection checkRedirect(java.net.URLConnection urlConnection)
throws java.io.IOException
urlConnection - if an HttpUrlConnection, check for 301 or 302; return connection otherwise.java.io.IOException