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.
-
HttpUtils()
-
-
base64Decode(InputStream)
- Decodes a Base64 from the specified input stream.
-
base64Decode(String)
- Decodes a Base64 encoded String.
-
encodeCgiData(Hashtable)
- URLEncodes a hashtable of key-value pairs.
-
parseBasicAuthentication(String)
- Parses a basic authentication field and returns the cookie.
-
parseBasicCookie(String)
- Parses a basic authentication string and returns an array with
username and password.
-
parseCgiData(int, InputStream)
- Parses Cgi data from an InputStream and makes
a hashtable with arrays of strings.
-
parseCgiData(int, Object)
- Parses Cgi data from an InputStream or a String and makes
a hashtable with arrays of strings.
-
parseCookieString(String)
- Parses a cookie string and returns a hashtable with arrays of strings.
-
parseQueryString(String)
- Parses Cgi data from a string and makes
a hashtable with arrays of strings.
-
urlDecode(String)
- Decodes an url encoded string into a ascii string.
HttpUtils
public HttpUtils()
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
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
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
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.
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.
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.
base64Decode
public static String base64Decode(String s)
- Decodes a Base64 encoded String.
- Parameters:
- s - the string to decode.
- Returns:
- a base64 decoded string
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.
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.
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