|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectpygmy.core.Http
public class Http
Utility class for HTTP error codes, and other command HTTP tasks.
Field Summary | |
---|---|
static java.lang.String |
CRLF
|
Constructor Summary | |
---|---|
Http()
|
Method Summary | |
---|---|
static java.lang.String |
encodeHtml(java.lang.String message)
This encodes the message into Html. |
static java.util.List |
findAllHostAddresses(boolean includeLoopback)
|
static java.net.InetAddress |
findRoutableHostAddress()
This method tries to find a suitable InetAddress that is routable. |
static java.lang.String |
formatTime(long time)
This formats the given time as a HTTP formatted string. |
static java.lang.String |
getCurrentTime()
This creates the current time as a string conforming to a HTTP date following the format EEE, dd MMM yyyy HH:mm:ss z. |
static java.lang.String |
getStatusPhrase(int code)
Given a HTTP response code, this method will return the english phrase. |
static boolean |
isSecure(java.lang.String root,
java.io.File file)
|
static java.lang.String |
join(java.lang.String path,
java.lang.String relativePath)
Takes two paths a joins them together properly adding the '/' charater between them. |
static long |
parseTime(java.lang.String date)
This parses the given time as a HTTP formatted string. |
static java.io.File |
translatePath(java.lang.String root,
java.lang.String url)
This translates a url into a path on the filesystem. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String CRLF
Constructor Detail |
---|
public Http()
Method Detail |
---|
public static java.lang.String getStatusPhrase(int code)
code
- the HTTP response code to look up.
public static java.lang.String encodeHtml(java.lang.String message)
message
- the message to encode.
public static java.lang.String getCurrentTime()
public static java.lang.String formatTime(long time)
time
- the time to format into a string.
public static long parseTime(java.lang.String date) throws java.text.ParseException
date
- The date represented as the format String EEE, dd MMM yyyy HH:mm:ss z.
java.text.ParseException
- throws this exeception when it cannot parse the date.public static java.lang.String join(java.lang.String path, java.lang.String relativePath)
path
- the first part of the path.relativePath
- the second part to join to the first path.
public static java.io.File translatePath(java.lang.String root, java.lang.String url) throws java.io.UnsupportedEncodingException
root
- this is an absolute path to prepend onto the url.url
- the url to resolve into the filesystem.
java.io.UnsupportedEncodingException
public static boolean isSecure(java.lang.String root, java.io.File file) throws java.io.IOException
java.io.IOException
public static java.net.InetAddress findRoutableHostAddress() throws java.net.UnknownHostException, java.net.SocketException
InetAddress.getLocalHost()
to find the local host. If that address it a site local address (192.168.*.*, 10.*.*.*, or 172.16.*.*) or the
loopback address (127.0.0.1), it enumerates all the NetworkInterfaces, and tries to find an address that is
not site local or loopback address. If it cannot it simply returns whatever InetAddress.getLocalHost()
.
java.net.UnknownHostException
java.net.SocketException
public static java.util.List findAllHostAddresses(boolean includeLoopback) throws java.net.SocketException
java.net.SocketException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |