org.encog.util.http
Class FormUtility
- java.lang.Object
-
- org.encog.util.http.FormUtility
-
public class FormUtility extends java.lang.ObjectThis class is used to construct responses to HTML forms. The class supports both standard HTML forms, as well as multipart forms.
-
-
Field Summary
Fields Modifier and Type Field and Description static intBUFFER_SIZEThe size of the read buffer.static java.lang.StringENCODEThe charset to use for URL encoding.static intRANDOM_LENGTHThe length of random string to create for multipart.
-
Constructor Summary
Constructors Constructor and Description FormUtility(java.io.OutputStream os, java.lang.String boundary)Prepare to access either a regular, or multipart, form.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidadd(java.lang.String name, java.io.File file)Add a file to a multipart form.voidadd(java.lang.String name, java.lang.String value)Add a regular text field to either a regular or multipart form.voidcomplete()Complete the building of the form.static java.lang.StringgetBoundary()Generate a boundary for a multipart form.static java.util.Map<java.lang.String,java.lang.String>parse(java.lang.String form)Parse a URL query string.
-
-
-
Field Detail
-
ENCODE
public static final java.lang.String ENCODE
The charset to use for URL encoding. Per URL coding spec, this value should always be UTF-8.- See Also:
- Constant Field Values
-
BUFFER_SIZE
public static final int BUFFER_SIZE
The size of the read buffer.- See Also:
- Constant Field Values
-
RANDOM_LENGTH
public static final int RANDOM_LENGTH
The length of random string to create for multipart.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
FormUtility
public FormUtility(java.io.OutputStream os, java.lang.String boundary)Prepare to access either a regular, or multipart, form.- Parameters:
os- The stream to output to.boundary- The boundary to be used, or null if this is not a multipart form.
-
-
Method Detail
-
getBoundary
public static java.lang.String getBoundary()
Generate a boundary for a multipart form.- Returns:
- The boundary.
-
parse
public static java.util.Map<java.lang.String,java.lang.String> parse(java.lang.String form)
Parse a URL query string. Return a map of all of the name value pairs.- Parameters:
form- The query string to parse.- Returns:
- A map of name-value pairs.
-
add
public void add(java.lang.String name, java.io.File file)Add a file to a multipart form.- Parameters:
name- The field name.file- The file to attach.
-
add
public void add(java.lang.String name, java.lang.String value)Add a regular text field to either a regular or multipart form.- Parameters:
name- The name of the field.value- The value of the field.
-
complete
public void complete()
Complete the building of the form.
-
-
DMelt 3.0 © DataMelt by jWork.ORG