org.apache.jserv
Class JServUtils
java.lang.Object
|
+--org.apache.jserv.JServUtils
- public final class JServUtils
- extends Object
Various utility methods used by the servlet engine.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
JServUtils
public JServUtils()
static void ()
encodeCookie
public static String encodeCookie(Cookie cookie)
- Encode a cookie as per the Netscape Cookies specification. The
resulting string can be used in a Set-Cookie header.
- Parameters:
cookie
- The cookie to encode.- Returns:
- A string following Netscape Cookies specification.
parseCharacterEncoding
public static String parseCharacterEncoding(String contentType)
- Parse a content-type header for the character encoding. If the
content-type is null or there is no explicit character encoding,
ISO-8859-1 is returned.
- Parameters:
contentType
- a content type header.
parseCookieHeader
public static Cookie[] parseCookieHeader(String cookieHdr)
- Parse a cookie header into an array of cookies as per
RFC2109 - HTTP Cookies
- Parameters:
cookieHdr
- The Cookie header value.
URLDecode
public static final String URLDecode(String str)
throws IllegalArgumentException
- This method decodes the given urlencoded string.
- Parameters:
str
- the url-encoded string- Returns:
- the decoded string
- Throws:
IllegalArgumentException
- If a '%' is not
followed by a valid 2-digit hex number.
URLEncode
public static final String URLEncode(String str)
- This method urlencodes the given string. This method is here for
symmetry and simplicity reasons and just calls URLEncoder.encode().
- Parameters:
str
- the string- Returns:
- the url-encoded string