org.apache.jserv
Class JServUtils
java.lang.Object
|
+--org.apache.jserv.JServUtils
- public final class JServUtils
- extends java.lang.Object
Various utility methods used by the servlet engine.
- Version:
- $Revision: 1.13 $ $Date: 2000/05/21 19:46:14 $
Field Summary |
private static java.text.SimpleDateFormat |
cookieDate
|
Method Summary |
(package private) static void |
()
|
static java.lang.String |
encodeCookie(javax.servlet.http.Cookie cookie)
Encode a cookie as per the Netscape Cookies specification. |
static java.lang.String |
parseCharacterEncoding(java.lang.String contentType)
Parse a content-type header for the character encoding. |
static javax.servlet.http.Cookie[] |
parseCookieHeader(java.lang.String cookieHdr)
Parse a cookie header into an array of cookies as per
RFC2109 - HTTP Cookies |
static java.lang.String |
URLDecode(java.lang.String str)
This method decodes the given urlencoded string. |
static java.lang.String |
URLEncode(java.lang.String str)
This method urlencodes the given string. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
registerNatives,
toString,
wait,
wait,
wait |
cookieDate
private static java.text.SimpleDateFormat cookieDate
JServUtils
public JServUtils()
URLEncode
public static final java.lang.String URLEncode(java.lang.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
URLDecode
public static final java.lang.String URLDecode(java.lang.String str)
throws java.lang.IllegalArgumentException
- This method decodes the given urlencoded string.
- Parameters:
str
- the url-encoded string- Returns:
- the decoded string
- Throws:
- java.lang.IllegalArgumentException - If a '%' is not
followed by a valid 2-digit hex number.
parseCookieHeader
public static javax.servlet.http.Cookie[] parseCookieHeader(java.lang.String cookieHdr)
- Parse a cookie header into an array of cookies as per
RFC2109 - HTTP Cookies
- Parameters:
cookieHdr
- The Cookie header value.
static void ()
encodeCookie
public static java.lang.String encodeCookie(javax.servlet.http.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 java.lang.String parseCharacterEncoding(java.lang.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.