如何使用jxbrowser(6.24)取消指定的URL请求
温馨提示:
本文最后更新于 2024年04月12日,已超过 37 天没有更新。若文章内的图片失效(无法正常加载),请留言反馈或直接联系我。
Because it is an old project, I used an older version of jxbrowser. The current requirement is that clicking the confirm button on the page will result in a post request, and I am not sending this request. I want to cancel this request. I couldn't find any implementation in the Default Network Delegate May I ask how to implement it.
public class BrowserNetworkDelegate extends DefaultNetworkDelegate {
@Override
public void onBeforeURLRequest(BeforeURLRequestParams params) {
System.out.println("onBeforeURLRequest|" + params.getURL() + "|" + params.getMethod() + "|" + ObjectMapperUtil.writeAsString(params.getUploadData()));
}
@Override
public void onBeforeSendHeaders(BeforeSendHeadersParams params) {
Map<String, List<String>> headers = params.getHeadersEx().getHeaders();
System.out.println("onBeforeSendHeaders|" + params.getURL() + "|" + params.getMethod() + "|" + ObjectMapperUtil.writeAsString(headers));
}
@Override
public void onDataReceived(DataReceivedParams params) {
System.out.println("onDataReceived|" + params.getURL() + "|" + new String(params.getData()));
}
}
正文到此结束
- 本文标签: 家庭宠物
- 本文链接: https://www.coder6.net/article/2431
- 版权声明: 本文由蚂蚁原创发布,转载请遵循《署名-非商业性使用-相同方式共享 4.0 国际 (CC BY-NC-SA 4.0)》许可协议授权