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:
- $Id$
- Author:
- Francis J. Lacoste, Ian Kluft
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 URL-encoded string. |
static java.lang.String |
URLEncode(java.lang.String str)
This method URL-encodes 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()
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.- Returns:
- A String.
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.- Returns:
- A Cookie[].
URLDecode
public static final java.lang.String URLDecode(java.lang.String str)
throws java.lang.IllegalArgumentException
- This method decodes the given URL-encoded 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 java.lang.String URLEncode(java.lang.String str)
- This method URL-encodes 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.
Copyright © 1999-2001 Apache Software Foundation. All Rights Reserved.