Class JSONUtils


  • public final class JSONUtils
    extends java.lang.Object
    Provides json utility methods for forms
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String JSON_KEY_FIELD_NAME
      JSON key for field name
      static java.lang.String JSON_KEY_SUCCESS
      JSON key to describe a success
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void buildJsonError​(com.fasterxml.jackson.databind.node.ObjectNode json, java.lang.String strMessage)
      Builds a json object with the error message.
      static com.fasterxml.jackson.databind.node.ObjectNode buildJsonErrorRemovingFile​(javax.servlet.http.HttpServletRequest request)
      Builds a json object with the error message.
      static com.fasterxml.jackson.databind.node.ObjectNode getUploadedFileJSON​(java.util.List<org.apache.commons.fileupload.FileItem> listFileItem)
      Builds a json object for the file item list.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • JSON_KEY_FIELD_NAME

        public static final java.lang.String JSON_KEY_FIELD_NAME
        JSON key for field name
        See Also:
        Constant Field Values
      • JSON_KEY_SUCCESS

        public static final java.lang.String JSON_KEY_SUCCESS
        JSON key to describe a success
        See Also:
        Constant Field Values
    • Method Detail

      • getUploadedFileJSON

        public static com.fasterxml.jackson.databind.node.ObjectNode getUploadedFileJSON​(java.util.List<org.apache.commons.fileupload.FileItem> listFileItem)
        Builds a json object for the file item list. Key is JSON_KEY_UPLOADED_FILES, value is the array of uploaded file.
        Parameters:
        listFileItem - the fileItem list
        Returns:
        the json
      • buildJsonErrorRemovingFile

        public static com.fasterxml.jackson.databind.node.ObjectNode buildJsonErrorRemovingFile​(javax.servlet.http.HttpServletRequest request)
        Builds a json object with the error message.
        Parameters:
        request - the request
        Returns:
        the json object.
      • buildJsonError

        public static void buildJsonError​(com.fasterxml.jackson.databind.node.ObjectNode json,
                                          java.lang.String strMessage)
        Builds a json object with the error message.
        Parameters:
        json - the JSON
        strMessage - the error message