Ejemplo n.º 1
0
 private static synchronized void kill() {
   if (sessionList != null) {
     for (HTTPSession session : sessionList) {
       session.close();
     }
     sessionList.clear();
     // Rebuild the connection manager
     connmgr.shutdown();
     connmgr = new MultiThreadedHttpConnectionManager();
     setGlobalThreadCount(DFALTTHREADCOUNT);
   }
 }
Ejemplo n.º 2
0
  protected void construct(String legalurl) throws HTTPException {
    this.legalurl = legalurl;
    try {
      sessionClient = new HttpClient(connmgr);
      HttpClientParams clientparams = sessionClient.getParams();

      // Allow (circular) redirects
      clientparams.setParameter(ALLOW_CIRCULAR_REDIRECTS, true);
      clientparams.setParameter(MAX_REDIRECTS, 25);

      if (globalSoTimeout > 0) setSoTimeout(globalSoTimeout);

      if (globalConnectionTimeout > 0) setConnectionTimeout(globalConnectionTimeout);

      if (globalAgent != null) setUserAgent(globalAgent); // May get overridden by setUserAgent

      setAuthenticationPreemptive(globalauthpreemptive);

      setProxy();

      if (TESTING) HTTPSession.track(this);

    } catch (Exception e) {
      throw new HTTPException("url=" + legalurl, e);
    }
  }