![]() |
The Simons
|
#include <CGIReader.h>
Inheritance diagram for CGIReader:
The CGIReader class is a kind of Reader that reconstructs a Map object from form data supplied by web browsers. CGIReader expects to receive a URL-encoded String on standard input, and so expects web forms to use the POST-method to submit their data. The length of the String to be read is determined from the environment variable CONTENT_LENGTH, which is defined by web browsers. CGIReader cannot be used in any other context where this variable is not defined. CGIReader decodes the String into a Map relating String keywords to String data values. The keywords are the web form's field names and the corresponding data values are whatever the user supplied, when filling in the form. Any form field may be looked up in the Map. Although each data value is stored as a String, it is possible to convert this to other basic types, using String's conversion methods. The original URL-encoded String is stored in the returned Map under the key "data".
Public Member Functions | |
CGIReader () | |
Construct a CGIReader stream. | |
virtual | ~CGIReader () |
Release an unused CGIReader stream. | |
virtual ObjectID | clone () const |
Clone a copy of this CGIReader. | |
virtual Void | openOn (StringID) |
Disable the redirection of the CGIReader's Input stream. | |
virtual ReaderID | getField (StringID, ObjectID &) |
Read in a Map from its URL-encoded form data representation. |
|
Construct a CGIReader stream. Constructs an CGIReader whose input is the standard TextInput stream, initially closed.
|
|
Release an unused CGIReader stream. Performs all closing actions to disconnect from the underlying filesystem. |
|
Clone a copy of this CGIReader. Creates a shallow copy, which shares the file path name, if any, but does not initialise any filesystem. Reimplemented from Object. |
|
Read in a Map from its URL-encoded form data representation. Not intended to be used directly by clients, getField("root", variable) is called by the top-level get() method of Reader. It initialises the argument variable with a Map whose domain and range are Strings, being the web form field-names and user-supplied data values decoded from the URL-encoded data string supplied on standard input. A ReadFailure exception may be raised if reading fails. A general Exception may be raised if the environment variable CONTENT_LENGTH is not defined, or the input String is not correctly URL-encoded.
Reimplemented from Reader. |
|
Disable the redirection of the CGIReader's Input stream. It is illegal for a CGIReader to attempt to read from anything other than the standard input, so this method is disabled, raising an Undefined exception. Likewise, no constructor is provided to create a CGIReader with an initial pathname.
Reimplemented from FormatStream. |