我正在研究Java中的小型浏览器实现.
我正在使用Apache HttpComponents 4.3.1,因为它有一个自动转发机制,但我无法弄清楚它是如何工作的.
从Apache docs Chapter 1. Fundamentals,我试图使用这段代码摘录:
LaxRedirectStrategy redirectStrategy = new LaxRedirectStrategy();
CloseableHttpClient httpclient = HttpClients.custom()
.setRedirectStrategy(redirectStrategy)
.build();
Run Code Online (Sandbox Code Playgroud)
这应该创建一个ClosableHttpClient可以自动转发使用.但在第二行(通过调用创建客户端.build())我收到此错误:
线程"AWT-EventQueue-0"中的异常java.lang.NoSuchFieldError:
INSTANCE at org.apache.http.impl.io.DefaultHttpRequestWriterFactory.<init>
(DefaultHttpRequestWriterFactory.java:52)
没有更多的代码,我只需通过以下方式调用此代码段:
HttpClient myClient = createClient();
Run Code Online (Sandbox Code Playgroud)
如果我使用explicit,它没有任何区别:
ClosableHttpClient myClient = createClient();
Run Code Online (Sandbox Code Playgroud)
(我在Apache教程中找到)
我怀疑某些库是干扰的,所以这是我的类路径概述:

目前我在C#环境中使用Awsomnium 1.7.我只是使用Core并尝试定义自定义帖子参数.现在,我搜索了很多,我甚至发布在awsomnium论坛,但没有答案.我理解这个概念,但最近的变化只是放弃了建议的机制和例子.
我找到了:http: //support.awesomium.com/kb/general-use/how-do-i-send-form-values-post-data
这样做的问题是,WebView类不再包含"OnResourceRequest"事件.到目前为止,我已经实现了IResourceInterceptor并且具有"OnRequest"-Function覆盖的公共ResourceResponse OnRequest(ResourceRequest请求)是签名,但我没有机会到达那里以添加请求头.这里有人有什么想法?我试着查看文档,但我没有找到任何关于.....