Package org.archive.wayback.core

Examples of org.archive.wayback.core.CaptureSearchResult


    if(numDates > 0) {
      results = new ArrayList<CaptureSearchResult>();
   
      for(int i = 0; i < numDates; i++) {
        String captureDate = getNodeTextValue(nodes.item(i));
        CaptureSearchResult result = new CaptureSearchResult();
        result.setFile(fileName);
        result.setCaptureTimestamp(captureDate);
        result.setHttpCode(httpCode);
        result.setDigest(digest);
        result.setMimeType(mimeType);
        result.setOffset(offset);
        result.setRedirectUrl(redirectUrl);
        result.setOriginalUrl(originalUrl);
        result.setUrlKey(urlKey);
        results.add(result);
      }
    }
    return results;
  }
View Full Code Here


   * @param urlString String URL that should be checked for blocking.
   * @param timestamp String 14-digit timestamp to check for blocking.
   * @return true if the url-timestamp should not be shown to end users
   */
  public boolean isExcluded(String urlString, String timestamp) {
    CaptureSearchResult sr = new CaptureSearchResult();

    sr.setOriginalUrl(urlString);
    sr.setCaptureTimestamp(Timestamp.parseBefore(timestamp).getDateStr());
   
    int ruling = filter.filterObject(sr);
    return (ruling != ObjectFilter.FILTER_INCLUDE);
  }
View Full Code Here

    pw.print(makeLink(getTimegateUrl(ap, requestUrl), TIMEGATE));
    pw.println(",");

    if (first.compareTo(last) == 0) {
      // special handling of single result:
      CaptureSearchResult result = results.getResults().get(0);
      pw.print(makeLink(ap, result.getOriginalUrl(), FIRST_LAST_MEMENTO, result));
    } else {
      List<CaptureSearchResult> lr = results.getResults();
      int count = lr.size();
      String rel;
      for (int i = 0; i < count; i++) {
        CaptureSearchResult result = lr.get(i);
        if (i == 0) {
          rel = FIRST_MEMENTO;
        } else if (i == count - 1) {
          pw.println(",");
          rel = LAST_MEMENTO;
        } else {
          pw.println(",");
          rel = MEMENTO;
        }
        pw.print(makeLink(ap, result.getOriginalUrl(), rel,
            result));
      }
    }
    // ludab nov 30 2012
    if (results.getMatchingCount() > results.getReturnedCount()) {
View Full Code Here

  }

  public static String generateMementoLinkHeaders(
      CaptureSearchResults results, WaybackRequest wbr, boolean includeTimegateLink, boolean includeOriginalLink) {
    NotableResultExtractor nre = getNotableResults(results);
    CaptureSearchResult first = nre.getFirst();
    CaptureSearchResult prev = nre.getPrev();
    CaptureSearchResult closest = nre.getClosest();
    CaptureSearchResult next = nre.getNext();
    CaptureSearchResult last = nre.getLast();
    ArrayList<String> rels = new ArrayList<String>();

    AccessPoint ap = wbr.getAccessPoint();

    String requestUrl = wbr.getRequestUrl();
View Full Code Here

    this.params = params;
  }
 
  @Override
  public CaptureSearchResult adapt(String line) {
    CaptureSearchResult result = CDXFlexFormat.parseCDXLineFlexFast(line);
   
    if (ignoreRobotPaths != null) {
      for (String path : ignoreRobotPaths) {
        if (result.getUrlKey().startsWith(path)) {
          result.setRobotIgnore();
          break;
        }
      }
    }
   
View Full Code Here

        EasyMock.expect(response.getOutputStream()).andReturn(servletOutput);
       
        wbRequest = new WaybackRequest();
        wbRequest.setFrameWrapperContext(false);
       
        result = new CaptureSearchResult();
        result.setOriginalUrl("http://www.example.com/");
        result.setCaptureTimestamp("20100101123456");
    }
View Full Code Here

    TestServletOutputStream servletOutput = new TestServletOutputStream();
    EasyMock.expect(response.getOutputStream()).andStubReturn(servletOutput);
   
    HttpServletRequest request = null; // assuming unused
    WaybackRequest wbRequest = new WaybackRequest();
    CaptureSearchResult result = new CaptureSearchResult();
    result.setOriginalUrl("http://home.archive.org/~hstern/ARI-3745/");
   
    EasyMock.replay(response);
   
    renderer.renderResource(request, response, wbRequest, result, payloadResource, payloadResource, proxyURIConverter, null);
   
View Full Code Here

                    Resource payloadResource, WaybackRequest wbRequest) {
                return "UTF-8";
            }
        });
       
        result = new CaptureSearchResult();
        result.setOriginalUrl("http://www.example.com/");
    }
View Full Code Here

    CaptureSearchResults results = new CaptureSearchResults();
    NodeList xresults = getSearchResults(document);
    int numAdded = 0;
    for(int i = 0; i < xresults.getLength(); i++) {
      Node xresult = xresults.item(i);
      CaptureSearchResult result = searchElementToCaptureSearchResult(xresult);
     
      int ruling = ObjectFilter.FILTER_INCLUDE;
      if (filter != null) {
        ruling = filter.filterObject(result);
      }
View Full Code Here

    addNodeDataToSearchResult(e,result);
    return result;
  }
  private CaptureSearchResult searchElementToCaptureSearchResult(Node e) {

    CaptureSearchResult result = new CaptureSearchResult();
    addNodeDataToSearchResult(e,result);
    return result;
  }
View Full Code Here

TOP

Related Classes of org.archive.wayback.core.CaptureSearchResult

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.