Handler with Java
The handler described here processes callbacks from the GrabzIt screenshot web service. The URL of this handler is passed to GrabzIt in the
callBackURL parameter of the Save method.
However this technique will only work if the handler is accessible via the Internet.
The following parameters are passed to the handler as GET parameters.
- id - the unique identifier of the screenshot, used by the GetResult method
- filename - the filename of the screenshot, automatically created by combining the screenshot's unique identifier with it's file extension
- message - any message due to an error caused during the processing of the screenshot
- customId - any custom id that was passed to the GrabzIt web service via the Save method
- format - the format of the screenshot, e.g "bmp8", "bmp16", "bmp24", "bmp", "csv", "gif", "jpg", "pdf", "png", "tiff" or "xlsx"
If you want to block all access to the handler, except from GrabzIt then use this security technique.
Remember this callback will not work if your application is located on localhost.
This example shows how the GrabzIt Java handler can be implemented. This captures five parameters passed to it from the GrabzIt service, including the unique id of the screenshot which is passed to the GetResult method.
This method then returns the screenshot, which is saved in the results directory.
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException
String message = request.getParameter("message");
String customId = request.getParameter("customid");
String id = request.getParameter("id");
String filename = request.getParameter("filename");
String format = request.getParameter("format");
GrabzItClient client = new GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret");
GrabzItFile file = client.GetResult(id);
if (file == null)
String path = getServletContext().getRealPath("/results") + File.separator + filename;
//You should log any errors