edu.utexas.its.eis.tools.qwicap.servlet
Class FormFileUpload

java.lang.Object
  extended by edu.utexas.its.eis.tools.qwicap.servlet.FormControlValue
      extended by edu.utexas.its.eis.tools.qwicap.servlet.FormFileUpload
All Implemented Interfaces:
Comparable<FormControlValue>, Iterable<String>

public final class FormFileUpload
extends FormControlValue

Represents files uploaded via "<input type='file' … />" elements in web page forms. FormFileUpload is a subclass of FormControlValue, so client code can receive and process uploaded files in exactly the same way it processes all other control values. In cases where client code needs to be aware that a parameter represents an uploaded file, it can use "instanceof FormFileUpload" to differentiate a FormFileUpload object from a FormControlValue object. If the parameter is an instance of FormFileUpload, the getFileItem() method can be used to gain access to the underlying FileItem object from the Jakarta Commons FileUpload library.

Author:
Chris W. Johnson

Method Summary
 FileItem getFileItem()
          Returns the underlying FileItem object that describes, and provides access to the data of, the uploaded file.
 String getValue()
          Returns the first value in the relevant form data set that was supplied by this control, or controls.
 String[] getValues()
          Returns all of the values in the relevant form data set that were supplied by this control, or controls.
 Iterator<String> iterator()
          Returns an Iterator of the values in the relevant form data set that were supplied by this control, or controls.
 
Methods inherited from class edu.utexas.its.eis.tools.qwicap.servlet.FormControlValue
compareTo, equals, getName, hashCode, isQwicapControl, isQwicapParameter
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getValue

public String getValue()
Description copied from class: FormControlValue
Returns the first value in the relevant form data set that was supplied by this control, or controls. This method is unsuitable for controls like checkboxes which may provide multiple values; use FormControlValue.getValues() when dealing such controls.

Overrides:
getValue in class FormControlValue
Returns:
The first value supplied by this control.
See Also:
FormControlValue.getValues()

getValues

public String[] getValues()
Description copied from class: FormControlValue
Returns all of the values in the relevant form data set that were supplied by this control, or controls. Multiple values are supplied by controls like checkboxes, or by any set of simultaneously successful controls of the same name.

Overrides:
getValues in class FormControlValue
Returns:
The values of this parameter represented as String array. For efficiency, the array returned is this object's own master copy, and its contents should not be modified.

iterator

public Iterator<String> iterator()
Description copied from class: FormControlValue
Returns an Iterator of the values in the relevant form data set that were supplied by this control, or controls. Multiple values are supplied by controls like checkboxes, or by any set of simultaneously successful controls of the same name.

Specified by:
iterator in interface Iterable<String>
Overrides:
iterator in class FormControlValue
Returns:
An Iterator of the strings representing the values of this control.

getFileItem

public FileItem getFileItem()
Returns the underlying FileItem object that describes, and provides access to the data of, the uploaded file. For files whose contents can usefully be treated as strings, using getValue() will be simpler.

Returns:
The FileItem object that describes, and provides access to the data of, the uploaded file.