| java.lang.Object pygmy.core.Http
Http | public class Http (Code) | | Utility class for HTTP error codes, and other command HTTP tasks.
|
Method Summary | |
public static String | encodeHtml(String message) This encodes the message into Html. | public static List | findAllHostAddresses(boolean includeLoopback) | public static InetAddress | findRoutableHostAddress() This method tries to find a suitable InetAddress that is routable. | public static String | formatTime(long time) This formats the given time as a HTTP formatted string. | public static 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. | public static String | getStatusPhrase(int code) Given a HTTP response code, this method will return the english phrase.
Parameters: code - the HTTP response code to look up. | public static boolean | isSecure(String root, File file) | public static String | join(String path, String relativePath) Takes two paths a joins them together properly adding the '/' charater between them.
Parameters: path - the first part of the path. Parameters: relativePath - the second part to join to the first path. | public static long | parseTime(String date) This parses the given time as a HTTP formatted string.
Parameters: date - The date represented as the format String EEE, dd MMM yyyy HH:mm:ss z. | public static File | translatePath(String root, String url) This translates a url into a path on the filesystem. |
encodeHtml | public static String encodeHtml(String message)(Code) | | This encodes the message into Html. It encodes characters '&', ''', '<', '>', and '"' into &, ',
<, >, and ".
Parameters: message - the message to encode. the encoded message. |
findRoutableHostAddress | public static InetAddress findRoutableHostAddress() throws UnknownHostException, SocketException(Code) | | This method tries to find a suitable InetAddress that is routable. It calls
java.net.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 .
the address of a non site local or non loopback address, unless there is only loopback or site local addresses. throws: UnknownHostException - throws: SocketException - |
formatTime | public static String formatTime(long time)(Code) | | This formats the given time as a HTTP formatted string. The format is EEE, dd MMM yyyy HH:mm:ss z.
Parameters: time - the time to format into a string. the formatted date. |
getCurrentTime | public static String getCurrentTime()(Code) | | This creates the current time as a string conforming to a HTTP date following the format
EEE, dd MMM yyyy HH:mm:ss z.
The a HTTP formated string of the current time. |
getStatusPhrase | public static String getStatusPhrase(int code)(Code) | | Given a HTTP response code, this method will return the english phrase.
Parameters: code - the HTTP response code to look up. A string describing what the HTTP response code is. |
join | public static String join(String path, String relativePath)(Code) | | Takes two paths a joins them together properly adding the '/' charater between them.
Parameters: path - the first part of the path. Parameters: relativePath - the second part to join to the first path. the combined path of path and relativePath. |
parseTime | public static long parseTime(String date) throws ParseException(Code) | | This parses the given time as a HTTP formatted string.
Parameters: date - The date represented as the format String EEE, dd MMM yyyy HH:mm:ss z. the time in milliseconds. throws: ParseException - throws this exeception when it cannot parse the date. |
translatePath | public static File translatePath(String root, String url) throws UnsupportedEncodingException(Code) | | This translates a url into a path on the filesystem. This decodes the url using the URLDecoder class, and
creates an absolute path beginning with root.
Parameters: root - this is an absolute path to prepend onto the url. Parameters: url - the url to resolve into the filesystem. the a File object representing this URL. throws: UnsupportedEncodingException - |
|
|