public final class JSONUtils extends Object
Modifier and Type | Field and Description |
---|---|
static String |
JSON_KEY_FIELD_NAME
JSON key for field name
|
static String |
JSON_KEY_SUCCESS
JSON key to describe a success
|
Modifier and Type | Method and Description |
---|---|
static GenericAttributeError |
buildFormError(String strJson)
Builds
GenericAttributeError from json string |
static String |
buildJson(GenericAttributeError formError)
Builds json form
GenericAttributeError |
static void |
buildJsonError(net.sf.json.JSONObject json,
String strMessage)
Builds a json object with the error message.
|
static net.sf.json.JSONObject |
buildJsonErrorRemovingFile(javax.servlet.http.HttpServletRequest request)
Builds a json object with the error message.
|
static Map<Integer,List<Response>> |
buildListResponses(String strJSON,
Locale locale,
javax.servlet.http.HttpSession session)
Builds the responses list - null if
JSON_KEY_RESPONSE is missing. |
static net.sf.json.JSONObject |
getUploadedFileJSON(List<org.apache.commons.fileupload.FileItem> listFileItem)
Builds a json object for the file item list.
|
public static final String JSON_KEY_FIELD_NAME
public static final String JSON_KEY_SUCCESS
public static Map<Integer,List<Response>> buildListResponses(String strJSON, Locale locale, javax.servlet.http.HttpSession session)
JSON_KEY_RESPONSE
is missing.strJSON
- the jsonlocale
- the localesession
- the sessionJSON_KEY_RESPONSE
is missingpublic static String buildJson(GenericAttributeError formError)
GenericAttributeError
formError
- GenericAttributeError
public static GenericAttributeError buildFormError(String strJson)
GenericAttributeError
from json stringstrJson
- json stringGenericAttributeError
public static net.sf.json.JSONObject getUploadedFileJSON(List<org.apache.commons.fileupload.FileItem> listFileItem)
JSON_KEY_UPLOADED_FILES
, value is the array of uploaded file.listFileItem
- the fileItem listpublic static net.sf.json.JSONObject buildJsonErrorRemovingFile(javax.servlet.http.HttpServletRequest request)
request
- the requestpublic static void buildJsonError(net.sf.json.JSONObject json, String strMessage)
json
- the JSONstrMessage
- the error messageCopyright © 2022 City of Paris. All rights reserved.