Tabnine Logo
CaptureSearchResult.<init>
Code IndexAdd Tabnine to your IDE (free)

How to use
org.archive.wayback.core.CaptureSearchResult
constructor

Best Java code snippets using org.archive.wayback.core.CaptureSearchResult.<init> (Showing top 20 results out of 315)

origin: iipc/openwayback

private CaptureSearchResult searchElementToCaptureSearchResult(Node e) {
  CaptureSearchResult result = new CaptureSearchResult();
  addNodeDataToSearchResult(e,result);
  return result;
}
origin: iipc/openwayback

public static CaptureSearchResult parseCDXLineFlex(String line) {
  CaptureSearchResult result = new CaptureSearchResult();
  return parseCDXLineFlex(line, result);
}

origin: org.netpreserve.openwayback/openwayback-core

public static CaptureSearchResult parseCDXLineFlex(String line) {
  CaptureSearchResult result = new CaptureSearchResult();
  return parseCDXLineFlex(line, result);
}

origin: org.netpreserve.openwayback/openwayback-core

private CaptureSearchResult searchElementToCaptureSearchResult(Node e) {
  CaptureSearchResult result = new CaptureSearchResult();
  addNodeDataToSearchResult(e,result);
  return result;
}
origin: org.netpreserve.openwayback/openwayback-core

/**
 * @param line
 * @return CaptureSearchResult containing data from the 'line' argument
 *         parsed according the the specification for this CDXFormat
 * @throws CDXFormatException
 */
public CaptureSearchResult parseResult(String line) 
throws CDXFormatException {
  CaptureSearchResult result = new CaptureSearchResult();
  String[] parts = line.split(delimiterS);
  if(parts.length != fields.length) {
    throw new CDXFormatException("Wrong number of fields");
  }
  for(int i = 0; i < fields.length; i++) {
    fields[i].apply(parts[i], result);
  }
  return result;
}
origin: iipc/openwayback

/**
 * @param line
 * @return CaptureSearchResult containing data from the 'line' argument
 *         parsed according the the specification for this CDXFormat
 * @throws CDXFormatException
 */
public CaptureSearchResult parseResult(String line) 
throws CDXFormatException {
  CaptureSearchResult result = new CaptureSearchResult();
  String[] parts = line.split(delimiterS);
  if(parts.length != fields.length) {
    throw new CDXFormatException("Wrong number of fields");
  }
  for(int i = 0; i < fields.length; i++) {
    fields[i].apply(parts[i], result);
  }
  return result;
}
origin: iipc/openwayback

private boolean isBlocked(ObjectFilter<CaptureSearchResult> filter, String url) {
  CaptureSearchResult result = new CaptureSearchResult();
  result.setOriginalUrl(url);
  int filterResult = filter.filterObject(result);
  if(filterResult == ObjectFilter.FILTER_EXCLUDE) {
    return true;
  }
  return false;
}

origin: iipc/openwayback

/**
 * @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);
}
origin: org.netpreserve.openwayback/openwayback-core

/**
 * @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);
}
origin: lintool/warcbase

@Override
public CaptureSearchResult next() {
 String line = it.next();
 String[] splits = line.split("\\s+");
 CaptureSearchResult r = new CaptureSearchResult();
 try {
  r.setCaptureDate(ArchiveUtils.parse14DigitDate(splits[0]));
 } catch (ParseException e) {
  e.printStackTrace();
 }
 r.setOriginalUrl(url);
 r.setUrlKey(urlKey);
 // doesn't matter, or we get NPE
 r.setMimeType(splits[1]);
 r.setFile("foo");
 // needed, or otherwise we'll get a NPE in CalendarResults.jsp
 r.setRedirectUrl("-");
 r.setHttpCode("200");
 r.setOffset(0);
 return r;
}
origin: iipc/openwayback

protected void setUp() throws Exception {
  super.setUp();
  cut = new RedirectRewritingHttpHeaderProcessor();
  cut.setPrefix("X-Archive-Orig-");
  uriConverter = new ResultURIConverter() {
    @Override
    public String makeReplayURI(String datespec, String url) {
      return datespec + "/" + url;
    }
  };
  result = new CaptureSearchResult();
  result.setCaptureTimestamp("20140102030405");
}
origin: iipc/openwayback

protected void setUp() throws Exception {
  super.setUp();
  RedirectRewritingHttpHeaderProcessor httpHeaderProcessor = new RedirectRewritingHttpHeaderProcessor();
  httpHeaderProcessor.setPrefix("X-Archive-Orig-");
  
  cut = new ArchivalUrlCSSReplayRenderer(httpHeaderProcessor);
  
  uriConverter = EasyMock.createMock(ResultURIConverter.class);
  
  response = EasyMock.createMock(HttpServletResponse.class);
  EasyMock.expect(response.getOutputStream()).andReturn(servletOutput);
  
  wbRequest = new WaybackRequest();
  wbRequest.setFrameWrapperContext(false);
  
  result = new CaptureSearchResult();
  result.setOriginalUrl("http://www.example.com/");
  result.setCaptureTimestamp("20100101123456");
}

origin: iipc/openwayback

/**
 * {@link MimeTypeDetector} overrides Content-Type in CaptureSearchResult.
 * @throws Exception
 */
public void testMimeTypeDetector() throws Exception {
  WaybackRequest wbRequest = new WaybackRequest();
  CaptureSearchResult result = new CaptureSearchResult();
  result.setMimeType("unk");
  Resource resource = createTestResource(null,
    "<html></html>".getBytes("UTF-8"));
  MimeTypeDetector detector = EasyMock.createMock(MimeTypeDetector.class);
  EasyMock.expect(detector.sniff(resource)).andReturn("text/javascript");
  cut.setMimeTypeDetectors(Collections.singletonList(detector));
  EasyMock.replay(detector);
  ReplayRenderer rr = cut.getRenderer(wbRequest, result, resource);
  assertEquals("js", ((TestReplayRenderer)rr).name);
  EasyMock.verify(detector);
}
origin: iipc/openwayback

/**
 * Use mime-type in CaptureSearchResult if MimeTypeDetector returns {@code null}.
 * @throws Exception
 */
public void testMimeTypeDetector_useIndexMimeTypeIfDetectionFailed() throws Exception {
  WaybackRequest wbRequest = new WaybackRequest();
  CaptureSearchResult result = new CaptureSearchResult();
  result.setMimeType("text/html");
  Resource resource = createTestResource("text/html; charset=UTF-8", "<TR><TD>A</TD></TR>".getBytes("UTF-8"));
  MimeTypeDetector detector = EasyMock.createMock(MimeTypeDetector.class);
  EasyMock.expect(detector.sniff(resource)).andReturn(null);
  cut.setMimeTypeDetectors(Collections.singletonList(detector));
  EasyMock.replay(detector);
  ReplayRenderer rr = cut.getRenderer(wbRequest, result, resource);
  assertEquals("html", ((TestReplayRenderer)rr).name);
  EasyMock.verify(detector);
}
origin: iipc/openwayback

/**
 * Test of non-default {@code missingMimeType}.
 * @throws Exception
 */
public void testMissingMimeType() throws Exception {
  final String MISSING_MIMETYPE = "application/http";
  WaybackRequest wbRequest = new WaybackRequest();
  CaptureSearchResult result = new CaptureSearchResult();
  result.setMimeType(MISSING_MIMETYPE);
  Resource resource = createTestResource(null,
    "var k = 1;".getBytes("UTF-8"));
  MimeTypeDetector detector = EasyMock.createMock(MimeTypeDetector.class);
  EasyMock.expect(detector.sniff(resource)).andReturn("text/javascript");
  cut.setMimeTypeDetectors(Collections.singletonList(detector));
  cut.setMissingMimeType(MISSING_MIMETYPE);
  EasyMock.replay(detector);
  ReplayRenderer rr = cut.getRenderer(wbRequest, result, resource);
  assertEquals("js", ((TestReplayRenderer)rr).name);
  EasyMock.verify(detector);
}
origin: iipc/openwayback

public void testMimeTypeFromIndex() throws Exception {
  WaybackRequest wbRequest = new WaybackRequest();
  CaptureSearchResult result = new CaptureSearchResult();
  result.setMimeType("text/javascript");
  Resource resource = createTestResource("text/javascript", "var i=1;".getBytes("UTF-8"));
  ReplayRenderer rr = cut.getRenderer(wbRequest, result, resource);
  assertEquals("js", ((TestReplayRenderer)rr).name);
}
origin: iipc/openwayback

private boolean isBlocked(ObjectFilter<CaptureSearchResult> filter, String url) throws URIException {
  CaptureSearchResult result = new CaptureSearchResult();
  result.setOriginalUrl(url);
  result.setUrlKey(canonicalizer.urlStringToKey(url));
  int filterResult = filter.filterObject(result);
  if(filterResult == ObjectFilter.FILTER_EXCLUDE) {
    return true;
  }
  return false;
}

origin: iipc/openwayback

/**
 * ContentTypeSniffer overrides Content-Type in CaptureSearchResult.
 * @throws Exception
 */
public void testMimeTypeDetector_ignoredIfForced() throws Exception {
  WaybackRequest wbRequest = new WaybackRequest();
  wbRequest.setCSSContext(true);
  CaptureSearchResult result = new CaptureSearchResult();
  result.setMimeType("unk");
  Resource resource = createTestResource(null,
    "body { margin: 0 }".getBytes("UTF-8"));
  MimeTypeDetector detector = EasyMock.createMock(MimeTypeDetector.class);
  // no call to ontentTypeSniffer
  //EasyMock.expect(sniffer.sniff(resource)).andReturn("text/javascript");
  cut.setMimeTypeDetectors(Collections.singletonList(detector));
  EasyMock.replay(detector);
  ReplayRenderer rr = cut.getRenderer(wbRequest, result, resource);
  assertNotNull(rr);
  assertEquals("css", ((TestReplayRenderer)rr).name);
  EasyMock.verify(detector);
}
origin: iipc/openwayback

public void testMimeTypeForced() throws Exception {
  WaybackRequest wbRequest = new WaybackRequest();
  wbRequest.setJSContext(true);
  CaptureSearchResult result = new CaptureSearchResult();
  result.setMimeType("text/plain");
  Resource resource = createTestResource("text/plain", "a".getBytes("UTF-8"));
  ReplayRenderer rr = cut.getRenderer(wbRequest, result, resource);
  assertEquals("js", ((TestReplayRenderer)rr).name);
}
origin: iipc/openwayback

public void testFilterObject() {
  List<String> in = Arrays.asList(patterns);
  FileRegexFilter f = new FileRegexFilter();
  f.setPatterns(in);
  CaptureSearchResult c = new CaptureSearchResult();
  c.setFile("one-11");
  assertEquals(f.filterObject(c), ObjectFilter.FILTER_INCLUDE);
  c.setFile("onedd-11");
  assertEquals(f.filterObject(c), ObjectFilter.FILTER_EXCLUDE);
  c.setFile("two-11");
  assertEquals(f.filterObject(c), ObjectFilter.FILTER_INCLUDE);
  f.setPatterns(new ArrayList<String>());
  assertEquals(f.filterObject(c), ObjectFilter.FILTER_EXCLUDE);
}
private boolean listCmp(List<String> one, List<String> two) {
org.archive.wayback.coreCaptureSearchResult<init>

Popular methods of CaptureSearchResult

  • setUrlKey
  • getOriginalUrl
  • setFile
  • setHttpCode
  • setMimeType
  • setOffset
  • setOriginalUrl
  • flagDuplicateDigest
    Mark this capture as a revisit of previous capture payload, identified by content digest.Record loca
  • getCaptureDate
  • getCaptureTimestamp
  • getDigest
  • getDuplicatePayload
  • getDigest,
  • getDuplicatePayload,
  • getDuplicatePayloadCompressedLength,
  • getDuplicatePayloadFile,
  • getDuplicatePayloadOffset,
  • getFile,
  • getOffset,
  • getRobotFlags,
  • getUrlKey

Popular in Java

  • Start an intent from android
  • getResourceAsStream (ClassLoader)
  • addToBackStack (FragmentTransaction)
  • scheduleAtFixedRate (Timer)
  • PrintStream (java.io)
    Fake signature of an existing Java class.
  • Date (java.sql)
    A class which can consume and produce dates in SQL Date format. Dates are represented in SQL as yyyy
  • Enumeration (java.util)
    A legacy iteration interface.New code should use Iterator instead. Iterator replaces the enumeration
  • Map (java.util)
    A Map is a data structure consisting of a set of keys and values in which each key is mapped to a si
  • ResourceBundle (java.util)
    ResourceBundle is an abstract class which is the superclass of classes which provide Locale-specifi
  • Annotation (javassist.bytecode.annotation)
    The annotation structure.An instance of this class is returned bygetAnnotations() in AnnotationsAttr
  • 21 Best IntelliJ Plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now