1

我正在尝试登录网站(使用 POST)并解析一些 HTML。登录有效(使用 jsoup),但是当我尝试解析整个页面时,Inputstream 缓冲区不够大,无法捕获整个页面。

public String Test() throws Exception {

    Log.d(TAG, "-->>> STARTING TEST");
    WebConversation wc = new WebConversation();
    WebRequest     req = new GetMethodWebRequest( "http://www.meterware.com/testpage.html" );
    WebResponse   resp = wc.getResponse( req );
    // Log.d(TAG, "Response : " + resp.toString());
    return resp.toString();
}

我收到一个错误:

06-21 20:12:52.945: W/dalvikvm(414): 无法解析 Lcom/meterware/httpunit/javascript/ScriptingEngineImpl 的超类;(826)

感谢所有帮助。即使这意味着切换到不同的解析器..(到目前为止,我已经尝试过 jsoup、htmlutil 和 httputil).. 都有自己的困难。我发现 httpUtil 最后一次更新是在 2008 年(?)。另外,我需要能够在 GET 请求中发送 cookie 的东西。

我的日志:

06-21 20:12:52.945: W/dalvikvm(414): Unable to resolve superclass of Lcom/meterware/httpunit/javascript/ScriptingEngineImpl; (826)
06-21 20:12:52.945: W/dalvikvm(414): Link of class 'Lcom/meterware/httpunit/javascript/ScriptingEngineImpl;' failed
06-21 20:12:52.945: W/dalvikvm(414): Unable to resolve superclass of Lcom/meterware/httpunit/dom/AbstractDomComponent; (279)
06-21 20:12:52.945: W/dalvikvm(414): Link of class 'Lcom/meterware/httpunit/dom/AbstractDomComponent;' failed
06-21 20:12:52.955: W/dalvikvm(414): Unable to resolve superclass of Lcom/meterware/httpunit/dom/DomWindow; (201)
06-21 20:12:52.955: W/dalvikvm(414): Link of class 'Lcom/meterware/httpunit/dom/DomWindow;' failed
06-21 20:12:52.955: E/dalvikvm(414): Could not find class 'com.meterware.httpunit.dom.DomWindow', referenced from method com.meterware.httpunit.WebResponse.createDomScriptingHandler
06-21 20:12:52.955: W/dalvikvm(414): VFY: unable to resolve new-instance 211 (Lcom/meterware/httpunit/dom/DomWindow;) in Lcom/meterware/httpunit/WebResponse;
06-21 20:12:52.955: D/dalvikvm(414): VFY: replacing opcode 0x22 at 0x0006
06-21 20:12:52.989: W/dalvikvm(414): Unable to resolve superclass of Lcom/meterware/httpunit/javascript/ScriptingEngineImpl; (826)
06-21 20:12:52.989: W/dalvikvm(414): Link of class 'Lcom/meterware/httpunit/javascript/ScriptingEngineImpl;' failed
06-21 20:12:53.006: W/dalvikvm(414): Unable to resolve superclass of Lcom/meterware/httpunit/dom/AbstractDomComponent; (279)
06-21 20:12:53.006: W/dalvikvm(414): Link of class 'Lcom/meterware/httpunit/dom/AbstractDomComponent;' failed
06-21 20:12:53.015: W/dalvikvm(414): Unable to resolve superclass of Lcom/meterware/httpunit/dom/NodeImpl; (201)
06-21 20:12:53.025: W/dalvikvm(414): Link of class 'Lcom/meterware/httpunit/dom/NodeImpl;' failed
06-21 20:12:53.025: W/dalvikvm(414): Unable to resolve superclass of Lcom/meterware/httpunit/dom/DocumentImpl; (256)
06-21 20:12:53.035: W/dalvikvm(414): Link of class 'Lcom/meterware/httpunit/dom/DocumentImpl;' failed
06-21 20:12:53.045: W/dalvikvm(414): Unable to resolve superclass of Lcom/meterware/httpunit/dom/HTMLDocumentImpl; (207)
06-21 20:12:53.045: W/dalvikvm(414): Link of class 'Lcom/meterware/httpunit/dom/HTMLDocumentImpl;' failed
06-21 20:12:53.045: E/dalvikvm(414): Could not find class 'com.meterware.httpunit.dom.HTMLDocumentImpl', referenced from method com.meterware.httpunit.WebResponse.createDomScriptingHandler
06-21 20:12:53.045: W/dalvikvm(414): VFY: unable to resolve check-cast 224 (Lcom/meterware/httpunit/dom/HTMLDocumentImpl;) in Lcom/meterware/httpunit/WebResponse;

/edit :我在控制台窗口中找到了这个。它给了我重新编译的线索。所以我获取了 httpUnit 的源代码并发出了一个 'jar cf * *'.. 但是当我将该 jar 添加到我的项目中时,我无法访问它的方法?!

[2012-06-21 22:12:06 - Mobile] Dx warning: Ignoring InnerClasses attribute for an anonymous inner class
(com.meterware.httpunit.Button$1) that doesn't come with an
associated EnclosingMethod attribute. This class was probably produced by a
compiler that did not target the modern .class file format. The recommended
solution is to recompile the class from source, using an up-to-date compiler
and without specifying any "-target" type options. The consequence of ignoring
this warning is that reflective operations on this class will incorrectly
indicate that it is *not* an inner class.

我尝试重新编译 .jar,但没有成功。也许我在那个过程中做错了什么,这会是解决方案吗?

4

0 回答 0