org.directwebremoting.extend
Class FormField

java.lang.Object
  extended by org.directwebremoting.extend.FormField

public class FormField
extends java.lang.Object

The result of a DWR query is normally a set of name/value pairs unless we are doing file-upload in which case there is more information with each field. This class replaces the value part of the set of name/value pairs to provide access to the extra information.

Author:
Lance Semmens [uklance at gmail dot com], Niklas Johansson [niklas dot json at gmail dot com]

Constructor Summary
FormField(java.lang.String string)
          Standard ctor for the normal non file-upload case
FormField(java.lang.String name, java.lang.String mimeType, long fileSize, InputStreamFactory inFactory)
          Ctor for when we are in the special file-upload case
 
Method Summary
 boolean equals(java.lang.Object obj)
           
 long getFileSize()
          Returns the size of the file.
 java.io.InputStream getInputStream()
          Returns an InputStream that can be used to retrieve the contents of the file.
 java.lang.String getMimeType()
          Returns the content type passed by the browser or null if not defined.
 java.lang.String getName()
          Returns the original filename in the client's file-system, as provided by the browser (or other client software).
 java.lang.String getString()
          Returns the contents of the file item as a String.
 int hashCode()
           
 boolean isFile()
          Determines whether or not a FormField instance represents a simple form field.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FormField

public FormField(java.lang.String string)
Standard ctor for the normal non file-upload case

Parameters:
string - The string value

FormField

public FormField(java.lang.String name,
                 java.lang.String mimeType,
                 long fileSize,
                 InputStreamFactory inFactory)
Ctor for when we are in the special file-upload case

Parameters:
name - The file name
mimeType - The mime type sent by the browser
fileSize - The size of the file sent by the browser
inFactory - FActory for the input stream sent by the browser
Method Detail

getMimeType

public java.lang.String getMimeType()
Returns the content type passed by the browser or null if not defined.

Returns:
The content type passed by the browser or null if not defined.

getFileSize

public long getFileSize()
Returns the size of the file.

Returns:
The size of the file.

getInputStream

public java.io.InputStream getInputStream()
                                   throws java.io.IOException
Returns an InputStream that can be used to retrieve the contents of the file.

Returns:
An InputStream that can be used to retrieve the contents of the file.
Throws:
java.io.IOException

getName

public java.lang.String getName()
Returns the original filename in the client's file-system, as provided by the browser (or other client software). In most cases, this will be the base file name, without path information. However, some clients, such as the Opera browser, do include path information.

Returns:
The original filename in the client's file-system.

getString

public java.lang.String getString()
Returns the contents of the file item as a String.


isFile

public boolean isFile()
Determines whether or not a FormField instance represents a simple form field.

Returns:
true for an uploaded file; false for a simple form field.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

Copyright 2008