public class FormUtils extends Object
Modifier and Type | Method and Description |
---|---|
static FormData |
create(CharSequence name,
CharSequence value,
boolean decode,
CharacterSet characterSet)
Creates a form data.
|
static void |
getEntries(Representation post,
Map<String,Object> entries)
Reads the entries whose name is a key in the given map.
If a matching entry is found, its value is put in the map. If multiple values are found, a list is created and set in the map. |
static void |
getEntries(String queryString,
Map<String,Object> entries,
CharacterSet characterSet,
char separator)
Reads the entries whose name is a key in the given map.
If a matching entry is found, its value is put in the map. If multiple values are found, a list is created and set in the map. |
static Object |
getEntry(Representation form,
String name)
Reads the entries with the given name.
If multiple values are found, a list is returned created. |
static Object |
getEntry(String query,
String name,
CharacterSet characterSet,
char separator)
Reads the entries with the given name.
If multiple values are found, a list is returned created. |
static FormData |
getFirstEntry(Representation post,
String name)
Reads the first entry with the given name.
|
static FormData |
getFirstEntry(String query,
String name,
CharacterSet characterSet,
char separator)
Reads the first entry with the given name.
|
static boolean |
isEntryFound(FormData searchedEntry,
MediaType mediaRange)
Indicates if the searched entry is specified in the given media range.
|
static void |
parse(Series<FormData> entries,
Representation post)
Parses a post into a given entries series.
|
static void |
parse(Series<FormData> entriesSeries,
String queryString,
CharacterSet characterSet,
boolean decode,
char separator)
Parses a entries string into a given form.
|
public static FormData create(CharSequence name, CharSequence value, boolean decode, CharacterSet characterSet)
name
- The name buffer.value
- The value buffer (can be null).decode
- If true, the name and values are decoded with the given
CharacterSet
, if false, than nothing is decoded.characterSet
- The supported character encoding.public static void getEntries(Representation post, Map<String,Object> entries) throws IOException
post
- The web form representation.entries
- The entries map controlling the reading.IOException
- If the entries could not be read.public static void getEntries(String queryString, Map<String,Object> entries, CharacterSet characterSet, char separator) throws IOException
queryString
- The query string.entries
- The entries map controlling the reading.characterSet
- The supported character encoding.separator
- The separator character to append between entries.IOException
- If the entries could not be read.public static Object getEntry(Representation form, String name) throws IOException
form
- The web form representation.name
- The name to match.IOException
- If the entries could not be read.public static Object getEntry(String query, String name, CharacterSet characterSet, char separator) throws IOException
query
- The query string.name
- The entry name to match.characterSet
- The supported character encoding.separator
- The separator character to append between entries.IOException
- If the entries could not be read.public static FormData getFirstEntry(Representation post, String name) throws IOException
post
- The web form representation.name
- The name to match.IOException
public static FormData getFirstEntry(String query, String name, CharacterSet characterSet, char separator) throws IOException
query
- The query string.name
- The name to match.characterSet
- The supported character encoding.separator
- The separator character to append between entries.IOException
public static boolean isEntryFound(FormData searchedEntry, MediaType mediaRange)
searchedEntry
- The searched entry.mediaRange
- The media range to inspect.public static void parse(Series<FormData> entries, Representation post)
entries
- The target entries series.post
- The posted form.public static void parse(Series<FormData> entriesSeries, String queryString, CharacterSet characterSet, boolean decode, char separator)
entriesSeries
- The target entries series.queryString
- The query string.characterSet
- The supported character encoding.decode
- Indicates if the query string should be decoded using the
given character set.separator
- The separator character to append between entries.Copyright © 2005–2015. All rights reserved.