org.mmbase.util
Class HttpPost

java.lang.Object
  |
  +--org.mmbase.util.HttpPost

public class HttpPost
extends java.lang.Object

WorkerPostHandler handles all the PostInformation

Version:
$Id: HttpPost.java,v 1.10 2001/07/02 15:09:49 pierre Exp $
Author:
Daniel Ockeloen, Rico Jansen, Rob Vermeulen

Constructor Summary
HttpPost(javax.servlet.http.HttpServletRequest req)
          Initialise WorkerPostHandler
 
Method Summary
 boolean checkPostMultiParameter(java.lang.String name)
           
protected  void finalize()
          Destuctor removes the tmp-files
 java.util.Vector getPostMultiParameter(java.lang.String name)
          This method returns the value of the postparameter as a Vector.
 java.lang.String getPostParameter(java.lang.String name)
          This method returns the value of the postparameter as a String.
 byte[] getPostParameterBytes(java.lang.String name)
          This method returns the value of the postparameter as a String.
 java.lang.String getPostParameterFile(java.lang.String name)
          This method returns the filename containing the postparametervalue If it is a parameter with multiple values it returns the first one.
 java.util.Hashtable getPostParameters()
          This method returns the Hashtable containing the POST information.
 byte[] readContentLength(javax.servlet.http.HttpServletRequest req)
          read a block into a array of ContentLenght size from the users networksocket
 boolean readPostFormData(byte[] postbuffer, java.util.Hashtable post_header, java.lang.String line)
          read post info from buffer, must be defined in multipart/form-data format.
 boolean readPostFormData(java.lang.String formFile, java.util.Hashtable post_header, java.lang.String line)
          read post info from buffer, must be defined in multipart/form-data format.
 void reset()
          resets WorkerPosthandler
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HttpPost

public HttpPost(javax.servlet.http.HttpServletRequest req)
Initialise WorkerPostHandler
Method Detail

finalize

protected void finalize()
Destuctor removes the tmp-files
Overrides:
finalize in class java.lang.Object

reset

public void reset()
resets WorkerPosthandler

checkPostMultiParameter

public boolean checkPostMultiParameter(java.lang.String name)
Returns:
the maximumsize of the postparametervalues to decode into memory

getPostParameters

public java.util.Hashtable getPostParameters()
This method returns the Hashtable containing the POST information. Use of this method is discouraged. Instead use getPostMultiParameter, getPostParameter and checkPostMulitparameter
See Also:
getPostMultiParameter(java.lang.String), getPostParameter(java.lang.String), checkPostMultiParameter(java.lang.String)

getPostParameterBytes

public byte[] getPostParameterBytes(java.lang.String name)
                             throws PostValueToLargeException
This method returns the value of the postparameter as a String. If it is a parameter with multiple values it returns the first one.
Throws:
PostValueToLargeException - will be thrown when the postParameterValue is saved on disk instead of memory.
See Also:
getPostMultiParameter(java.lang.String), checkPostMultiParameter(java.lang.String)

getPostMultiParameter

public java.util.Vector getPostMultiParameter(java.lang.String name)
This method returns the value of the postparameter as a Vector. In case of a parameter with one value, it returns it as a Vector with one element. it laso converts the byte[] into strings
See Also:
checkPostMultiParameter(java.lang.String)

getPostParameterFile

public java.lang.String getPostParameterFile(java.lang.String name)
This method returns the filename containing the postparametervalue If it is a parameter with multiple values it returns the first one.
See Also:
getPostMultiParameter(java.lang.String), checkPostMultiParameter(java.lang.String)

getPostParameter

public java.lang.String getPostParameter(java.lang.String name)
This method returns the value of the postparameter as a String. If it is a parameter with multiple values it returns the first one.
See Also:
getPostMultiParameter(java.lang.String), checkPostMultiParameter(java.lang.String)

readContentLength

public byte[] readContentLength(javax.servlet.http.HttpServletRequest req)
read a block into a array of ContentLenght size from the users networksocket
Parameters:
table - the hashtable that is used as the source for the mapping process
Returns:
byte[] buffer of length defined in the content-length mimeheader

readPostFormData

public boolean readPostFormData(byte[] postbuffer,
                                java.util.Hashtable post_header,
                                java.lang.String line)
read post info from buffer, must be defined in multipart/form-data format.
Parameters:
postbuffer - buffer with the postbuffer information
post_header - hashtable to put the postbuffer information in

readPostFormData

public boolean readPostFormData(java.lang.String formFile,
                                java.util.Hashtable post_header,
                                java.lang.String line)
read post info from buffer, must be defined in multipart/form-data format. Deze methode gaat in het beginsel alleen werken voor het uploaden van 1 bestand De te vinden markers kunnen anders op de scheiding liggen van 2 blokken Het kan dus voorkomen dat de marker op de scheiding ligt van 2 blokken ook dan zal deze methode falen.
Parameters:
postbuffer - buffer with the postbuffer information
post_header - hashtable to put the fromFile information in


MMBase 2001