Class AjaxUtils

java.lang.Object
overit.geocall.ui.AjaxUtils

public class AjaxUtils extends Object
This class implements a different utils method to manage errors occur during an ajax communication, from client to server.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    Constant that define the html file type.
    static final String
    Constant that define the image type.
    static final String
    Constant that define the text file type.
    static final String
    Constant that define the xml file type.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    Crates a complete error message and send it through an HttpServletResponse given in input.
    The response page message, with the error, can be an "image/png" content type page, an "text/plain" content type page, an "text/html" standard content type page or ab an "text/xml" content type page.
    static String
    Gets the string with the error passed by parameter.
    If the error is a String ( so an error defined programmatically) will be returned that string, if the error given by input come from an Exception will be returned a string with the error message (from the Exception raised) and the complete stackTrace of the error.
    Gets an 8-bit RGB BufferedImage with inside the error message passed by parameter and width and height predefined by default to 200 pixels.
    getImageError(String error, int width, int height)
    Gets an 8-bit RGB BufferedImage with inside the error message passed by parameter.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • AjaxUtils

      public AjaxUtils()
  • Method Details

    • getImageError

      public static BufferedImage getImageError(String error)
      Gets an 8-bit RGB BufferedImage with inside the error message passed by parameter and width and height predefined by default to 200 pixels.
      Parameters:
      error - The error to draw inside the image.
      Returns:
      an 8-bit RGB image BufferedImage inside the error message passed by parameter and width and height predefined by default to 200 pixels.
    • getImageError

      public static BufferedImage getImageError(String error, int width, int height)
      Gets an 8-bit RGB BufferedImage with inside the error message passed by parameter.
      Parameters:
      error - The error to draw inside the image.
      width - The image's width.
      height - The image's height.
      Returns:
      an 8-bit RGB image BufferedImage inside the error message passed by parameter.
    • getError

      public static String getError(Object error)
      Gets the string with the error passed by parameter.
      If the error is a String ( so an error defined programmatically) will be returned that string, if the error given by input come from an Exception will be returned a string with the error message (from the Exception raised) and the complete stackTrace of the error.
      Parameters:
      error - The error given by input, it could be a String or an Exception.
      Returns:
      The string with the error passed by parameter.
    • ajaxQueryError

      public static void ajaxQueryError(HttpServletRequest request, HttpServletResponse response, Object error)
      Crates a complete error message and send it through an HttpServletResponse given in input.
      The response page message, with the error, can be an "image/png" content type page, an "text/plain" content type page, an "text/html" standard content type page or ab an "text/xml" content type page.
      Parameters:
      request - The HttpServletRequest containing the type of the response page and , in case the type is image/png, the widht and the height of the image.
      response - The HttpServletResponse through which the error message will be printed out.
      error - The error to print inside the Response page.