Top Description Inners Fields Constructors Methods
io.undertow.server.handlers.form

public final Class FormData

extends Object
implements Iterable<String>
Class Inheritance
All Implemented Interfaces
java.lang.Iterable
Imports
java.io.BufferedInputStream, .ByteArrayInputStream, .File, .IOException, .InputStream, java.nio.file.Files, .NoSuchFileException, .Path, .StandardCopyOption, java.util.ArrayDeque, .Deque, .Iterator, .LinkedHashMap, .Map, io.undertow.UndertowMessages, io.undertow.util.FileUtils, .HeaderMap

Representation of form data.

Todo

add representation of multipart data

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
public static interface
pack-priv static class

Field Summary

Modifier and TypeField and Description
private final int
private int
private final Map<String, Deque<FormData.FormValue>>

Constructor Summary

AccessConstructor and Description
public
FormData(final int maxValues)

Method Summary

Modifier and TypeMethod and Description
public void
add(String name, byte[] value, String fileName, HeaderMap headers)

public void
add(String name, String value)

public void
add(String name, String value, final HeaderMap headers)

public void
add(String name, String value, String charset, final HeaderMap headers)

public void
add(String name, Path value, String fileName, final HeaderMap headers)

public void
add(String name, Path value, String fileName, final HeaderMap headers, boolean bigField, String charset)

public boolean
public boolean
equals(final Object
the reference object with which to compare.
o
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

public Deque<FormData.FormValue>
get(String name)

public FormData.FormValue
public FormData.FormValue
public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.

public Iterator<String>
iterator()

Implements java.lang.Iterable.iterator.

Returns an iterator over elements of type T.

public void
put(String name, String value, final HeaderMap headers)

public Deque<FormData.FormValue>
remove(String name)

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

maxValuesback to summary
private final int maxValues
valueCountback to summary
private int valueCount
valuesback to summary
private final Map<String, Deque<FormData.FormValue>> values

Constructor Detail

FormDataback to summary
public FormData(final int maxValues)

Method Detail

addback to summary
public void add(String name, byte[] value, String fileName, HeaderMap headers)
addback to summary
public void add(String name, String value)
addback to summary
public void add(String name, String value, final HeaderMap headers)
addback to summary
public void add(String name, String value, String charset, final HeaderMap headers)
addback to summary
public void add(String name, Path value, String fileName, final HeaderMap headers)
addback to summary
public void add(String name, Path value, String fileName, final HeaderMap headers, boolean bigField, String charset)
containsback to summary
public boolean contains(String name)
equalsback to summary
public boolean equals(final Object o)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
o:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
getback to summary
public Deque<FormData.FormValue> get(String name)
getFirstback to summary
public FormData.FormValue getFirst(String name)
getLastback to summary
public FormData.FormValue getLast(String name)
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object

Annotations
@Override
iteratorback to summary
public Iterator<String> iterator()

Implements java.lang.Iterable.iterator.

Doc from java.lang.Iterable.iterator.

Returns an iterator over elements of type T.

Returns:Iterator<String>

an Iterator.

putback to summary
public void put(String name, String value, final HeaderMap headers)
removeback to summary
public Deque<FormData.FormValue> remove(String name)
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override
io.undertow.server.handlers.form back to summary

public Class FormData.FileItem

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final byte[]
private final Path

Constructor Summary

AccessConstructor and Description
public
FileItem(Path file)

public
FileItem(byte[] content)

Method Summary

Modifier and TypeMethod and Description
public void
public Path
public long
public InputStream
public boolean
public void
write(Path target)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

contentback to summary
private final byte[] content
fileback to summary
private final Path file

Constructor Detail

FileItemback to summary
public FileItem(Path file)
FileItemback to summary
public FileItem(byte[] content)

Method Detail

deleteback to summary
public void delete() throws IOException
getFileback to summary
public Path getFile()
getFileSizeback to summary
public long getFileSize() throws IOException
getInputStreamback to summary
public InputStream getInputStream() throws IOException
isInMemoryback to summary
public boolean isInMemory()
writeback to summary
public void write(Path target) throws IOException
io.undertow.server.handlers.form back to summary

public Interface FormData.FormValue

Known Direct Implementers
io.undertow.server.handlers.form.FormData.FormValueImpl

Method Summary

Modifier and TypeMethod and Description
public String

Returns:

The charset of the simple string value
getCharset
()

public File
getFile()
Deprecated

public FormData.FileItem
public String

Returns:

The filename specified in the disposition header.
getFileName
()

public HeaderMap

Returns:

The headers that were present in the multipart request, or null if this was not a multipart request
getHeaders
()

public Path

Returns:

The temp file that the file data was saved to
getPath
()
Deprecated

public String

Returns:

the simple string value.
getValue
()

public boolean

Returns:

true if size of the FormValue comes from a multipart request exceeds the fieldSizeThreshold of MultiPartParserDefinition without filename specified. A big field is stored in disk, it is a file based FileItem. getValue() returns getCharset() decoded string from the file if it is true.
isBigField
()

public boolean
isFile()
Deprecated

Returns true if this is a file and not a simple string

public boolean

Method Detail

getCharsetback to summary
public String getCharset()
Returns:String

The charset of the simple string value

getFileback to summary
public File getFile()

Deprecated

Annotations
@Deprecated
getFileItemback to summary
public FormData.FileItem getFileItem()
getFileNameback to summary
public String getFileName()
Returns:String

The filename specified in the disposition header.

getHeadersback to summary
public HeaderMap getHeaders()
Returns:HeaderMap

The headers that were present in the multipart request, or null if this was not a multipart request

getPathback to summary
public Path getPath()

Deprecated

Returns:Path

The temp file that the file data was saved to

Annotations
@Deprecated
Exceptions
IllegalStateException:
if this is not a file
getValueback to summary
public String getValue()
Returns:String

the simple string value.

Exceptions
IllegalStateException:
If this is not a simple string value
isBigFieldback to summary
public boolean isBigField()
Returns:boolean

true if size of the FormValue comes from a multipart request exceeds the fieldSizeThreshold of MultiPartParserDefinition without filename specified. A big field is stored in disk, it is a file based FileItem. getValue() returns getCharset() decoded string from the file if it is true.

isFileback to summary
public boolean isFile()

Deprecated

Returns true if this is a file and not a simple string

Annotations
@Deprecated
isFileItemback to summary
public boolean isFileItem()
io.undertow.server.handlers.form back to summary

pack-priv Class FormData.FormValueImpl

extends Object
implements FormValue
Class Inheritance
All Implemented Interfaces
io.undertow.server.handlers.form.FormData.FormValue

Field Summary

Modifier and TypeField and Description
private final boolean
private final String
private final FormData.FileItem
private final String
private final HeaderMap
private final String

Constructor Summary

AccessConstructor and Description
pack-priv
FormValueImpl(String value, HeaderMap headers)

pack-priv
FormValueImpl(String value, String charset, HeaderMap headers)

pack-priv
FormValueImpl(Path file, final String fileName, HeaderMap headers, boolean bigField, String charset)

pack-priv
FormValueImpl(byte[] data, String fileName, HeaderMap headers)

Method Summary

Modifier and TypeMethod and Description
public String
public File
public FormData.FileItem
public String
public HeaderMap
public Path
public String
public boolean
public boolean
isFile()

Implements io.undertow.server.handlers.form.FormData.FormValue.isFile.

Returns true if this is a file and not a simple string

public boolean
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

bigFieldback to summary
private final boolean bigField
charsetback to summary
private final String charset
fileItemback to summary
private final FormData.FileItem fileItem
fileNameback to summary
private final String fileName
headersback to summary
private final HeaderMap headers
valueback to summary
private final String value

Constructor Detail

FormValueImplback to summary
pack-priv FormValueImpl(String value, HeaderMap headers)
FormValueImplback to summary
pack-priv FormValueImpl(String value, String charset, HeaderMap headers)
FormValueImplback to summary
pack-priv FormValueImpl(Path file, final String fileName, HeaderMap headers, boolean bigField, String charset)
FormValueImplback to summary
pack-priv FormValueImpl(byte[] data, String fileName, HeaderMap headers)

Method Detail

getCharsetback to summary
public String getCharset()

Implements io.undertow.server.handlers.form.FormData.FormValue.getCharset.

Returns:String

Doc from io.undertow.server.handlers.form.FormData.FormValue.getCharset.

The charset of the simple string value

Annotations
@Override
getFileback to summary
public File getFile()

Implements io.undertow.server.handlers.form.FormData.FormValue.getFile.

Annotations
@Override
getFileItemback to summary
public FormData.FileItem getFileItem()

Implements io.undertow.server.handlers.form.FormData.FormValue.getFileItem.

Annotations
@Override
getFileNameback to summary
public String getFileName()

Implements io.undertow.server.handlers.form.FormData.FormValue.getFileName.

Returns:String

Doc from io.undertow.server.handlers.form.FormData.FormValue.getFileName.

The filename specified in the disposition header.

getHeadersback to summary
public HeaderMap getHeaders()

Implements io.undertow.server.handlers.form.FormData.FormValue.getHeaders.

Returns:HeaderMap

Doc from io.undertow.server.handlers.form.FormData.FormValue.getHeaders.

The headers that were present in the multipart request, or null if this was not a multipart request

Annotations
@Override
getPathback to summary
public Path getPath()

Implements io.undertow.server.handlers.form.FormData.FormValue.getPath.

Returns:Path

Doc from io.undertow.server.handlers.form.FormData.FormValue.getPath.

The temp file that the file data was saved to

Annotations
@Override
getValueback to summary
public String getValue()

Implements io.undertow.server.handlers.form.FormData.FormValue.getValue.

Returns:String

Doc from io.undertow.server.handlers.form.FormData.FormValue.getValue.

the simple string value.

Annotations
@Override
isBigFieldback to summary
public boolean isBigField()

Implements io.undertow.server.handlers.form.FormData.FormValue.isBigField.

Returns:boolean

Doc from io.undertow.server.handlers.form.FormData.FormValue.isBigField.

true if size of the FormValue comes from a multipart request exceeds the fieldSizeThreshold of MultiPartParserDefinition without filename specified. A big field is stored in disk, it is a file based FileItem. getValue() returns getCharset() decoded string from the file if it is true.

isFileback to summary
public boolean isFile()

Implements io.undertow.server.handlers.form.FormData.FormValue.isFile.

Doc from io.undertow.server.handlers.form.FormData.FormValue.isFile.

Returns true if this is a file and not a simple string

Annotations
@Override
isFileItemback to summary
public boolean isFileItem()

Implements io.undertow.server.handlers.form.FormData.FormValue.isFileItem.

Annotations
@Override