使用jxbrowser,如何获得每个响应

时间:2016-04-09 04:19:53

标签: jxbrowser

jxbrowser 4.4:

browser.getHTML()方法只获取加载html的所有请求。 我希望每个请求都返回响应内容。

NetworkDelegate onCompleted方法只获取每个url,如何获取每个响应内容? 任何人都可以举例说明如何获得每个回复。 感谢。

browser.getContext().setNetworkDelegate(new NetworkDelegate() {
    @Override
    public void onSendHeaders(SendHeadersParams arg0) {
    }
    @Override
    public void onResponseStarted(ResponseStartedParams arg0) {
    }
    @Override
    public void onHeadersReceived(HeadersReceivedParams arg0) {
    }

    @Override
    public void onCompleted(RequestCompletedParams arg0) {
        System.out.println("onCompleted-----> " + arg0.getURL());
        // this place only get url, how to get each response content?
        // this place only get url, how to get each response content?
    }
    @Override
    public void onBeforeURLRequest(BeforeURLRequestParams arg0) {
    }
    @Override
    public void onBeforeSendHeaders(BeforeSendHeadersParams arg0) {
    }
    @Override
    public void onBeforeRedirect(BeforeRedirectParams arg0) {
    }
    @Override
    public boolean onAuthRequired(AuthRequiredParams arg0) {
        return false;
    }
});

0 个答案:

没有答案