Examples of ValidHosts


Examples of org.eweb4j.spiderman.xml.ValidHosts

  public synchronized Collection<Task> pushTask(Collection<Task> validTasks) throws Exception{
    Collection<Task> newTasks = new ArrayList<Task>();
    for (Task task : validTasks){
      try{
        //如果不是在给定的合法host列表里则不给于抓取
        ValidHosts vhs = task.site.getValidHosts();
        if (vhs == null || vhs.getValidHost() == null || vhs.getValidHost().isEmpty()){
//          System.out.println("isSameHost?->"+CommonUtil.isSameHost(task.site.getUrl(), task.url)+", url->"+task.url);
          if (!CommonUtil.isSameHost(task.site.getUrl(), task.url))
            continue;
        }else{
          boolean isOk = false;
          String taskHost = new URL(task.url).getHost();
          for (ValidHost h : vhs.getValidHost()){
            if (taskHost.equals(h.getValue())){
              isOk = true;
              break;
            }
          }
View Full Code Here

Examples of org.eweb4j.spiderman.xml.ValidHosts

public class BeginPointImpl implements BeginPoint{

  public Task confirmTask(Task task) throws Exception{
    //如果不是在给定的合法host列表里则不给于抓取
    ValidHosts vhs = task.site.getValidHosts();
    if (vhs == null || vhs.getValidHost() == null || vhs.getValidHost().isEmpty()){
      if (!CommonUtil.isSameHost(task.site.getUrl(), task.url))
        return null;
    }else{
      boolean isOk = false;
      String taskHost = new URL(task.url).getHost();
      for (ValidHost h : vhs.getValidHost()){
        if (taskHost.equals(h.getValue())){
          isOk = true;
          break;
        }
      }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.