All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class sics.agentbase.http.HttpUtils

java.lang.Object
   |
   +----sics.agentbase.http.HttpUtils

public class HttpUtils
extends Object
Some useful utilities for HTTP request/response processing.


Constructor Index

 o HttpUtils()

Method Index

 o base64Decode(InputStream)
Decodes a Base64 from the specified input stream.
 o base64Decode(String)
Decodes a Base64 encoded String.
 o encodeCgiData(Hashtable)
URLEncodes a hashtable of key-value pairs.
 o parseBasicAuthentication(String)
Parses a basic authentication field and returns the cookie.
 o parseBasicCookie(String)
Parses a basic authentication string and returns an array with username and password.
 o parseCgiData(int, InputStream)
Parses Cgi data from an InputStream and makes a hashtable with arrays of strings.
 o parseCgiData(int, Object)
Parses Cgi data from an InputStream or a String and makes a hashtable with arrays of strings.
 o parseCookieString(String)
Parses a cookie string and returns a hashtable with arrays of strings.
 o parseQueryString(String)
Parses Cgi data from a string and makes a hashtable with arrays of strings.
 o urlDecode(String)
Decodes an url encoded string into a ascii string.

Constructors

 o HttpUtils
 public HttpUtils()

Methods

 o parseCgiData
 public static Hashtable parseCgiData(int length,
                                      Object content)
Parses Cgi data from an InputStream or a String and makes a hashtable with arrays of strings.

Parameters:
length - the length of the Cgi Data
content - the Cgi Data
Returns:
a hashtable with parsed Cgi information
 o parseCgiData
 public static Hashtable parseCgiData(int length,
                                      InputStream in)
Parses Cgi data from an InputStream and makes a hashtable with arrays of strings.

Parameters:
length - the length of the Cgi Data
content - the Cgi Data
Returns:
a hashtable with parsed Cgi information
 o parseQueryString
 public static Hashtable parseQueryString(String content)
Parses Cgi data from a string and makes a hashtable with arrays of strings.

Parameters:
content - the Cgi Data
Returns:
a hashtable with parsed Cgi information
 o parseCookieString
 public static Hashtable parseCookieString(String cookies)
Parses a cookie string and returns a hashtable with arrays of strings.

Parameters:
cookies - the cookie data.
Returns:
a hashtable with the parsed cookie information.
 o parseBasicAuthentication
 public static String parseBasicAuthentication(String field)
Parses a basic authentication field and returns the cookie.

Parameters:
field - the basic authentication field.
Returns:
the basic authentication cookie or null if the field could not be parsed.
 o parseBasicCookie
 public static String[] parseBasicCookie(String basicCookie)
Parses a basic authentication string and returns an array with username and password.

Parameters:
basicCookie - the basic authenticatio cookie.
Returns:
an array with the username and password or null.
 o base64Decode
 public static String base64Decode(String s)
Decodes a Base64 encoded String.

Parameters:
s - the string to decode.
Returns:
a base64 decoded string
 o base64Decode
 public static String base64Decode(InputStream input)
Decodes a Base64 from the specified input stream.

Parameters:
in - the input stream to read from.
Returns:
a base64 decoded string read from the specified input stream.
 o encodeCgiData
 public static String encodeCgiData(Hashtable ht)
URLEncodes a hashtable of key-value pairs.

Parameters:
ht - the Hashtable.
Returns:
a URL-encoded string suitable for using in POST-requests.
 o urlDecode
 public static String urlDecode(String encoded)
Decodes an url encoded string into a ascii string.

Parameters:
encoded - the url encoded string.
Returns:
a decoded string

All Packages  Class Hierarchy  This Package  Previous  Next  Index