All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class org.apache.jserv.JServUtils

java.lang.Object
   |
   +----org.apache.jserv.JServUtils

public final class JServUtils
extends Object
Various utility methods used by the servlet engine.

Author:
Francis J. Lacoste, Ian Kluft

Method Index

 o encodeCookie(Cookie)
Encode a cookie as per the Netscape Cookies specification.
 o parseCharacterEncoding(String)
Parse a content-type header for the character encoding.
 o parseCookieHeader(String)
Parse a cookie header into an array of cookies as per the Netscape Cookie specification.
 o URLDecode(String)
This method decodes the given urlencoded string.
 o URLEncode(String)
This method urlencodes the given string.

Methods

 o 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
 o 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.
 o parseCookieHeader
 public static Cookie[] parseCookieHeader(String cookieHdr)
Parse a cookie header into an array of cookies as per the Netscape Cookie specification.

Parameters:
cookieHdr - The Cookie header value.
 o 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.
 o 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.

All Packages  Class Hierarchy  This Package  Previous  Next  Index