Package overit.geocall.ui
Class AjaxUtils
java.lang.Object
overit.geocall.ui.AjaxUtils
This class implements a different utils method to manage errors occur during an ajax communication, from client to server.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidajaxQueryError(HttpServletRequest request, HttpServletResponse response, Object error) Crates a complete error message and send it through anHttpServletResponsegiven 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 StringGets 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 anExceptionwill be returned a string with the error message (from the Exception raised) and the complete stackTrace of the error.static BufferedImagegetImageError(String error) Gets an 8-bit RGBBufferedImagewith inside the error message passed by parameter and width and height predefined by default to 200 pixels.static BufferedImagegetImageError(String error, int width, int height) Gets an 8-bit RGBBufferedImagewith inside the error message passed by parameter.
-
Field Details
-
TYPE_IMG
Constant that define the image type.- See Also:
-
TYPE_TXT
Constant that define the text file type.- See Also:
-
TYPE_XML
Constant that define the xml file type.- See Also:
-
TYPE_HTML
Constant that define the html file type.- See Also:
-
-
Constructor Details
-
AjaxUtils
public AjaxUtils()
-
-
Method Details
-
getImageError
Gets an 8-bit RGBBufferedImagewith 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
BufferedImageinside the error message passed by parameter and width and height predefined by default to 200 pixels.
-
getImageError
Gets an 8-bit RGBBufferedImagewith 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
BufferedImageinside the error message passed by parameter.
-
getError
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 anExceptionwill 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 anException.- 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 anHttpServletResponsegiven 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- TheHttpServletRequestcontaining the type of the response page and , in case the type is image/png, the widht and the height of the image.response- TheHttpServletResponsethrough which the error message will be printed out.error- The error to print inside the Response page.
-