Package org.apache.droids.helper.factories

Examples of org.apache.droids.helper.factories.ProtocolFactory


  }
 
  public static Droid<Link> createSimpleExceptionCrawlingDroid(
      String targetURI) {
    ParserFactory parserFactory = createDefaultParserFactory();
    ProtocolFactory protocolFactory = createDefaultProtocolFactory();
    URLFiltersFactory filtersFactory = createDefaultURLFiltersFactory();

    SimpleDelayTimer simpleDelayTimer = new SimpleDelayTimer();
    simpleDelayTimer.setDelayMillis(100);
   
View Full Code Here


    htmlParser.getElements().put("img", "src");
    htmlParser.getElements().put("script", "src");
    parserFactory.getMap().put("text/html", htmlParser);

    // Create protocol factory. Support HTTP/S only.
    ProtocolFactory protocolFactory = new ProtocolFactory();
   
    // Create and configure HTTP client
    HttpParams params = new BasicHttpParams();
    HttpProtocolParamBean hppb = new HttpProtocolParamBean(params);
    HttpConnectionParamBean hcpb = new HttpConnectionParamBean(params);
    ConnManagerParamBean cmpb = new ConnManagerParamBean(params);
   
    // Set protocol parametes
    hppb.setVersion(HttpVersion.HTTP_1_1);
    hppb.setContentCharset(HTTP.ISO_8859_1);
    hppb.setUseExpectContinue(true);
    // Set connection parameters
    hcpb.setStaleCheckingEnabled(false);
    // Set connection manager parameters
    ConnPerRouteBean connPerRouteBean = new ConnPerRouteBean();
    connPerRouteBean.setDefaultMaxPerRoute(2);
    cmpb.setConnectionsPerRoute(connPerRouteBean);
   
    DroidsHttpClient httpclient = new DroidsHttpClient(params);
   
    HttpProtocol httpProtocol = new HttpProtocol(httpclient);
    protocolFactory.getMap().put("http", httpProtocol);
    protocolFactory.getMap().put("https", httpProtocol);
   
    // Create URL filter factory.
    URLFiltersFactory filtersFactory = new URLFiltersFactory();
    RegexURLFilter defaultURLFilter = new RegexURLFilter();
    defaultURLFilter.setFile("classpath:/regex-urlfilter.txt");
View Full Code Here

TOP

Related Classes of org.apache.droids.helper.factories.ProtocolFactory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.