捕获和转换Web的工具

Java处理程序

Java API

产品描述

在调试处理程序时遇到问题吗? 尝试 回调处理程序测试工具。

此处描述的处理程序处理来自GrabzIt屏幕快照Web服务的回调。 该处理程序的URL在以下位置传递给GrabzIt: callBackURL 的参数 Save 方法。 但是,只有在可以通过 Int以太网

以下参数作为GET参数传递给处理程序。

如果要阻止对处理程序的所有访问,除了GrabzIt之外,请使用此方法 安全技术.

例如:

请记住,如果您的应用程序位于localhost上,则此回调将不起作用。

此示例展示了如何实现 GrabzIt Java 处理程序。这会捕获从 GrabzIt 服务传递给它的六个参数,包括传递给 GetResult 方法。

然后,此方法返回屏幕截图,即 saved在结果目录中。

    @Override
    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");
        String targetError = request.getParameter("targeterror");

        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)
        {
            return;
        }

        String path = getServletContext().getRealPath("/results") + File.separator + filename;

        try
        {
            file.Save(path);
        }
        catch(Exception ex)
        {
            //You should log any errors
        }
    }