@Override
 public void onHTTPInterceptHeaders(NetworkEvent ne) {
   l.debug("onHTTPInterceptHeaders " + ne.getURL());
   l.trace("Send Request Header:\n" + ne.getMutableRequestHeaders());
   String userAgent = BrowserContext.getConfigure().getProperty("Browser", "User-Agent");
   if (null != userAgent) {
     ne.getMutableRequestHeaders().addHeader("User-Agent", userAgent, true);
   }
   context.addRequestHeader(ne.getURL(), ne.getMutableRequestHeaders().toString());
 }
  @Override
  public void onDocumentComplete(NetworkEvent ne) {
    l.debug("onDocumentComplete " + ne.getURL());
    try {
      context.setReference(ne.getURL());
      progress.setValue(progress.getMaximum());
      progress.setVisible(false);
      addressTextField.setText(ne.getURL());
      String title =
          null != context.getBrowser().getDocument()
              ? context.getBrowser().getDocument().getTitle()
              : "";
      context.getConsole().log("title: " + title);
      context.getSimpleBrowser().getAnalyzerFrame().setTitle(title);
      // 更新页面信息
      context.getSimpleBrowser().getPageInfoPanel().update();

      // 显示源代码
      IDocument doc = context.getBrowser().getDocument();
      if (null != doc) {
        context.getSimpleBrowser().setSource(doc.getBody().getParentElement().getInnerHTML());
      }

      timer.cancel();
      timer = null;
      if (couldProcess()) {
        process();
      }
    } catch (Exception ex) {
    }
  }
 @Override
 public void onHTTPResponse(NetworkEvent ne) {
   //        l.debug("onHTTPResponse\n" + ne.getResponseHeaders());
   l.debug("onHTTPResponse\n" + ne.getURL() + " : " + ne.getStatus() + " : " + ne.getStatusText());
   l.debug("onHTTPResponse\n" + ne.getFrame());
   context.addResponseHeader(ne.getURL(), ne.getResponseHeaders());
 }
 private void process() {
   context.getConsole().log("Referrer: " + context.getBrowser().getDocument().getReferrer());
   //        VIPSImpl vips = new VIPSImpl(context);
   //        vips.segment(context.getBrowser().getDocument());
 }
 public SimpleNetworkListener(BrowserContext context) {
   this.context = context;
   this.browser = context.getBrowser();
 }