org.apache.struts.upload
public class MultipartElement extends Object
Deprecated: Use the Commons FileUpload based multipart handler instead. This class will be removed after Struts 1.2.
This class represents an element in a multipart request. It has a few methods for determining * whether or not the element is a String or a file, and methods to retrieve the data of the aforementioned element. Text input elements have anull
content type,
files have a non-null content type.
Field Summary | |
---|---|
protected String | contentType
The content type of this element. |
protected byte[] | data
The element data. |
protected File | file
The element's data represented in a (possibly temporary) file. |
protected String | fileName
The element's filename, null for text elements. |
protected boolean | isFile
Whether or not this element is a file. |
protected String | name
The element name. |
protected String | value
The element's text value, null for file elements |
Constructor Summary | |
---|---|
MultipartElement(String name, String fileName, String contentType, File file)
Constructor for a file element. | |
MultipartElement(String name, String value)
Constructor for a text element. |
Method Summary | |
---|---|
String | getContentType()
Retrieve the content type. |
File | getFile()
Get the File that holds the data for this element. |
String | getFileName()
Retrieve the filename, can return null
for text elements. |
String | getName()
Retrieve the name. |
String | getValue()
Returns the value of this multipart element. |
boolean | isFile()
Is this element a file. |
void | setContentType(String contentType)
Set the content type. |
void | setFile(File file)
Set the file that represents this element. |
void | setFileName(String fileName)
Set the file name for this element. |
void | setName(String name)
Set the name for this element. |
void | setValue(String value) |
Deprecated: This should never be used.
The element data.Parameters: name The form name of the element fileName The file name of the element if this element is a file contentType The content type of the element if a file file The (possibly temporary) file representing this element if it's a file
Parameters: name The name of the element value The value of the element
null
for text elements.Returns: A String if the element is a text element, null
otherwise