htmlParser.getElements().put("script", "src");
parserFactory.setMap(new HashMap<String, Object>());
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.setMap(new HashMap<String, Object>());
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");