Java Tool Kit

ITT.WAFr.Utilities
Class Upload

java.lang.Object
  extended byITT.WAFr.Utilities.Upload

public final class Upload
extends Object

The Upload class represents a "multipart/form-data" encoded post data block.

This class contains simple methods to retrieve posted files and other posted form element properties otherwise not accessible when encoded with "multipart/form-data".


Nested Class Summary
 class Upload.FormEncodingTypeException
          This exception is thrown when the HttpServletRequest object's encoding type is not of type 'MultiPart/Form-Data'.
 class Upload.FormMethodException
          This exception is thrown when the HttpServletRequest object's HTTP method is not of type 'POST'.
 class Upload.PostedFile
          The PostedFile class represents the content and properties of a posted "multipart/form-data" encoded file.
 
Constructor Summary
Upload(HttpServletRequest request)
          Constructs a new Upload object that retrieves all "multipart/form-data" encoded post data from a HttpServletRequest object.
 
Method Summary
 String ElementValue(String sName)
          Retrieves a the String value of a specified posted form element that does not contain a posted file.
 Upload.PostedFile File(String sName)
          Retrieves a PostedFile object contained within the specified posted form element.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Upload

public Upload(HttpServletRequest request)
       throws Upload.FormMethodException,
              Upload.FormEncodingTypeException,
              IOException
Constructs a new Upload object that retrieves all "multipart/form-data" encoded post data from a HttpServletRequest object.

Parameters:
request - the HttpServletRequest object containing the "multipart/form-data" encoded post data.
Throws:
IOException - if the HttpServletRequest object cannot be read.
Upload.FormEncodingTypeException - if the posted form is not of encode type "multipart/form-data".
Upload.FormMethodException - if the HttpServletRequest object does not have a method of "POST".
Method Detail

ElementValue

public String ElementValue(String sName)
Retrieves a the String value of a specified posted form element that does not contain a posted file.

Posted data is usually retrievable via the HttpServletRequest.getParameter() method. When utilizing "multipart/form-data" encoded form data, this method of element retrieval is not available.

Therefore, to retrieve the values of input, select, textarea, or other form element values posted with a "multipart/form-data" encoded form, use this method.

Parameters:
sName - a String containing the value of the name attribute of the posted form element.
Returns:
a String containing the value of the specified form element.

File

public Upload.PostedFile File(String sName)
Retrieves a PostedFile object contained within the specified posted form element.

Parameters:
sName - a String containing the value of the name attribute of the posted form element.
Returns:
a PostedFile object containing the contents and properties for the posted file.
See Also:
Upload.PostedFile

Java Tool Kit

Copyright ©2004, If•Then Technology