0
我想捕捉当用户点击一个链接时提出的mozswing请求,或者提交一个表单,以便套接字连接永远不会发生,我可以回答“我自己”的请求。如何在mozswing中捕获请求?
我想捕捉当用户点击一个链接时提出的mozswing请求,或者提交一个表单,以便套接字连接永远不会发生,我可以回答“我自己”的请求。如何在mozswing中捕获请求?
我发现该怎么做。我希望这有助于某人。
编辑:最好的办法听链接:
final ContentAdapter ca = moz.getChromeAdapter().getContentAdapter();
nsIURIContentListener mycl = new nsIURIContentListener() {
public boolean onStartURIOpen(nsIURI aURI) {
System.out.println(aURI.getHost() + aURI.getPath());
return true;
}
public boolean doContent(String aContentType, boolean aIsContentPreferred, nsIRequest aRequest, nsIStreamListener[] aContentHandler) {
System.out.println("1");
return ca.doContent(aContentType, aIsContentPreferred, aRequest, aContentHandler);
}
public boolean isPreferred(String aContentType, String[] aDesiredContentType) {
System.out.println("2");
return ca.isPreferred(aContentType, aDesiredContentType);
}
public boolean canHandleContent(String aContentType, boolean aIsContentPreferred, String[] aDesiredContentType) {
System.out.println("3");
return ca.canHandleContent(aContentType, aIsContentPreferred, aDesiredContentType);
}
public nsISupports getLoadCookie() {
System.out.println("4");
return ca.getLoadCookie();
}
public void setLoadCookie(nsISupports aLoadCookie) {
System.out.println("5");
ca.setLoadCookie(aLoadCookie);
}
public nsIURIContentListener getParentContentListener() {
System.out.println("6");
return ca.getParentContentListener();
}
public void setParentContentListener(nsIURIContentListener aParentContentListener) {
System.out.println("7");
ca.setParentContentListener(aParentContentListener);
}
public nsISupports queryInterface(String uuid) {
System.out.println("8");
return ca.queryInterface(uuid);
}
};
moz.getChromeAdapter().getWebBrowser().setParentURIContentListener(mycl);
这不是我想要的。我想要捕捉浏览器发出的请求,以便它们永远不会碰到套接字,而是直接处理请求并回答它。无论如何,我不确定这是否可行。这背后的想法是能够通过webstart部署基于web的应用程序,而不必向用户请求特殊的权限。 – amirouche 2011-04-10 12:48:26
你好,你有没有发现一个解决方案?我也需要它... – Laphroaig 2011-03-02 22:31:03