org.locomotive.server
Class FormParser
java.lang.Object
|
+--org.locomotive.server.FormParser
- public class FormParser
- extends java.lang.Object
This class takes care of parsing out forms HTTP forms. The multipart forms
algorithm just isn't very pretty, and probably should be rewritten...
Constructor Summary |
FormParser(java.io.InputStream in,
java.util.Hashtable cgi_hash,
LocoConfig conf,
Log log)
instantiates the parser. |
Method Summary |
void |
log(int loglevel,
java.lang.String message)
logs the message to the log specifed in the constructor, using the
specified log level |
java.util.Hashtable |
parseForm()
this method returns a hashtable with all the data from the form
it will figure out whether the form is normal or
mulitpart, and handle it accordingly. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
FormParser
public FormParser(java.io.InputStream in,
java.util.Hashtable cgi_hash,
LocoConfig conf,
Log log)
throws ParseFormException
- instantiates the parser.
- Parameters:
cgi_hash
- the hashtable containing the cgi environmentin
- the inputstream to read fromconf
- the config file to read such attributes as maximum
form content size and the upload directorylog
- the log to write to- Throws:
- org.locomotive.loco.ParseFormException - if the content-length
is corrupted
parseForm
public java.util.Hashtable parseForm()
throws ParseFormException
- this method returns a hashtable with all the data from the form
it will figure out whether the form is normal or
mulitpart, and handle it accordingly.
For multipart forms, all body parts containing a 'filename'
attribute are written to a file in the directory specified by
by the LOCO_UPLOAD_PATH config variable.
- Throws:
- org.locomotive.loco.ParseFormException - if the content length of the
form being sent is longer than the _FORM_CONTENT_LENGTH
configs,
or if the form is corrupted.
log
public void log(int loglevel,
java.lang.String message)
- logs the message to the log specifed in the constructor, using the
specified log level