Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.lutris.http
Class HttpUtils  view HttpUtils download HttpUtils.java

java.lang.Object
  extended bycom.lutris.http.HttpUtils

public class HttpUtils
extends java.lang.Object

Utility methods useful to for HTTP.


Constructor Summary
HttpUtils()
           
 
Method Summary
private static void AddKey(java.util.Hashtable table, java.lang.String key, java.lang.String value)
          Adds the pair key and value to table.
static java.lang.StringBuffer getRequestURL(com.lutris.appserver.server.httpPresentation.HttpPresentationRequest req)
          Obtains the URL used by the client to make the current request, without the query parameters.
static java.util.Hashtable parsePostData(int len, java.io.InputStream in)
          Parses FORM data posted by a client using the HTTP POST method and the application/x-www-form-urlencoded MIME type.
static java.util.Hashtable parseQueryString(java.lang.String s)
          Decodes a query string in the format specified by the MIME type "application/x-www-form-urlencoded".
static java.lang.String trimQueryString(java.lang.String s)
          Trims the left-hand side of a URL until the character '?' is reached.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HttpUtils

public HttpUtils()
Method Detail

AddKey

private static void AddKey(java.util.Hashtable table,
                           java.lang.String key,
                           java.lang.String value)
Adds the pair key and value to table. If key already exists, then value is added as the end of an array of existing values, and the new array is assigned as the value for key. If key does not yet exist, the value is assigned as the value for key.


trimQueryString

public static java.lang.String trimQueryString(java.lang.String s)
Trims the left-hand side of a URL until the character '?' is reached. This is useful for raw URLs that need to be parsed as query strings.


parseQueryString

public static java.util.Hashtable parseQueryString(java.lang.String s)
Decodes a query string in the format specified by the MIME type "application/x-www-form-urlencoded". Such a string consists of encoded key/value pairs in the form key=value. A hash table is returned with each value indexed by its corresponding key. If a key appears once in the query string, then the value will be of type String. If the key appears more than once, then the value will be an array of type String.


parsePostData

public static java.util.Hashtable parsePostData(int len,
                                                java.io.InputStream in)
                                         throws java.lang.IllegalArgumentException,
                                                java.io.IOException
Parses FORM data posted by a client using the HTTP POST method and the application/x-www-form-urlencoded MIME type.


getRequestURL

public static java.lang.StringBuffer getRequestURL(com.lutris.appserver.server.httpPresentation.HttpPresentationRequest req)
                                            throws com.lutris.appserver.server.httpPresentation.HttpPresentationException
Obtains the URL used by the client to make the current request, without the query parameters. Returns a StringBuffer object that can be appended to, if the query string must be appended.