com.ibm.wbi.protocol.http.beans
Class FormHelper

java.lang.Object
  |
  +--com.ibm.wbi.protocol.http.beans.FormHelper

public class FormHelper
extends java.lang.Object

Helper class to access the form data of an HTTP request. Form data is one or more key-value-pairs contained in the URL of an HTTP request. Example:

    http://www.ibm.com/search?key1=value1&key2=value2
 
The pairs key1/value1 and key2/value2 represent the form data.


Field Summary
static java.lang.String COPYRIGHT
          IBM copyright information
 
Constructor Summary
FormHelper()
           
 
Method Summary
static java.lang.String decodeString(java.lang.String coded)
          Decodes a given String of form data.
static java.util.Properties interpretFormData(MegInputStream in, DocumentInfo di)
          Deprecated. Use interpretFormData(Reader, DocumentInfo) instead.
static java.util.Properties interpretFormData(java.io.Reader in, DocumentInfo di)
          Access the form data of an HTTP request through the request event's InputStream and Document information objects.
static java.util.Properties interpretFormData(ResponseToRequest rtr)
          Interpret the form data of an HTTP request.
static java.util.Properties interpretFormData(java.lang.String formData)
          Interpret the content of a string as form data.
static FormData interpretMultipartFormData(RequestEvent e)
          Parse an uploaded form of type "multipart/form-data".
protected static java.lang.String stripAnyQuotes(java.lang.String a)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COPYRIGHT

public static final java.lang.String COPYRIGHT
IBM copyright information
Constructor Detail

FormHelper

public FormHelper()
Method Detail

interpretFormData

public static java.util.Properties interpretFormData(ResponseToRequest rtr)
Interpret the form data of an HTTP request. This only works for GET forms or for POST forms of type application/www-form-urlencoded. For POST forms of type multipart/form-data, use interpretMultipartFormData.
Parameters:
rtr - ResponseToRequest (ServiceResult or RequestEvent)
Returns:
The form data as key-value-pairs in java.util.Properties object.

interpretFormData

public static java.util.Properties interpretFormData(MegInputStream in,
                                                     DocumentInfo di)
Deprecated. Use interpretFormData(Reader, DocumentInfo) instead.

Access the form data of an HTTP request through the request event's InputStream and Document information objects.
Parameters:
in - Inputstream of the current request event.
di - Document information object.
Returns:
The form data as key-value-pairs in java.util.Properties object.

interpretFormData

public static java.util.Properties interpretFormData(java.io.Reader in,
                                                     DocumentInfo di)
Access the form data of an HTTP request through the request event's InputStream and Document information objects.
Parameters:
in - Reader of the current request event.
di - Document information object.
Returns:
The form data as key-value-pairs in java.util.Properties object.

interpretFormData

public static java.util.Properties interpretFormData(java.lang.String formData)
Interpret the content of a string as form data.
Parameters:
formData - String holding the form data.
Returns:
The form data as key-value-pairs in java.util.Properties object.

decodeString

public static java.lang.String decodeString(java.lang.String coded)
Decodes a given String of form data. Certain characters are encoded such that strings can be used in the form data of an HTTP request. This method reverses this process.
Parameters:
coded - Part of the form data.
Returns:
Decoded part of the form data.

interpretMultipartFormData

public static FormData interpretMultipartFormData(RequestEvent e)
Parse an uploaded form of type "multipart/form-data". "Parts" of the form without an explicit MIME type are assumed to be text/plain and are stored in the FormData object as Strings. Others are stored as MimeObjects.
Parameters:
e - The RequestEvent containing the posted form.
Returns:
The objects that make up the form, as a FormData object.

stripAnyQuotes

protected static java.lang.String stripAnyQuotes(java.lang.String a)