Examples of ARCRecord


Examples of org.archive.io.arc.ARCRecord

            public String getVersion() {
                return null;
            }

        };
        ARCRecord r = new ARCRecord(new ByteArrayInputStream(hdr.getBytes()),
                arh, 0, false, true, false);

        HeaderedArchiveRecord har = new HeaderedArchiveRecord(r, true);
        har.skipHttpHeader();
        byte[] b = new byte[BODY.length()];
View Full Code Here

Examples of org.archive.io.arc.ARCRecord

        final String url = "http://www.archive.org/index.htm";
        final String arcHeader = url
                + " 192.168.0.1 20070515111004 text/html 167568\n";
        final String hdr = arcHeader + HTTPHEADER + BODY;

        ARCRecord r = new ARCRecord(new ByteArrayInputStream(hdr.getBytes()),
                "READER_IDENTIFIER", 0, false, true, false);

        HeaderedArchiveRecord har = new HeaderedArchiveRecord(r, true);
        har.skipHttpHeader();
        byte[] b = new byte[BODY.length()];
View Full Code Here

Examples of org.archive.io.arc.ARCRecord

    /* (non-Javadoc)
     * @see org.archive.wayback.util.Adapter#adapt(java.lang.Object)
     */
    public ARCRecord adapt(ArchiveRecord o) {
      ARCRecord rec = null;
      if(o instanceof ARCRecord) {
        rec = (ARCRecord) o;
      }
      return rec;
    }
View Full Code Here

Examples of org.archive.io.arc.ARCRecord

    public void testPlainHttpRecord() throws Exception {
        String payload = "hogehogehogehogehoge";
        WARCRecordInfo recinfo = TestWARCRecordInfo.createHttpResponse(payload);
        recinfo.setMimetype("text/plain");
        TestARCReader ar = new TestARCReader(recinfo);
        ARCRecord rec = ar.get(0);
        ArcResource res = new ArcResource(rec, ar);
        res.parseHeaders();
       
        assertEquals("statusCode", 200, res.getStatusCode());
        assertEquals("content-type", "text/plain", res.getHeader("Content-Type"));
View Full Code Here

Examples of org.archive.io.arc.ARCRecord

        WARCRecordInfo recinfo = new TestWARCRecordInfo(
                TestWARCRecordInfo.buildHttpResponseBlock("200 OK",
                        "text/plain", payload.getBytes("UTF-8"), true));
        recinfo.setMimetype("text/plain");
        TestARCReader ar = new TestARCReader(recinfo);
        ARCRecord rec = ar.get(0);
        ArcResource res = new ArcResource(rec, ar);
        res.parseHeaders();
       
        assertEquals("statusCode", 200, res.getStatusCode());
        assertEquals("content-type", "text/plain", res.getHeader("Content-Type"));
View Full Code Here

Examples of org.archive.io.arc.ARCRecord

        WARCRecordInfo recinfo = new TestWARCRecordInfo(
                TestWARCRecordInfo.buildCompressedHttpResponseBlock(ctype,
                        payload.getBytes()));
        recinfo.setMimetype(ctype);
        TestARCReader ar = new TestARCReader(recinfo);
        ARCRecord rec = ar.get(0);
        ArcResource res = new ArcResource(rec, ar);
        res.parseHeaders();
       
        assertEquals("statusCode", 200, res.getStatusCode());
        assertEquals("content-type", ctype, res.getHeader("Content-Type"));
View Full Code Here

Examples of org.archive.io.arc.ARCRecord

        WARCRecordInfo recinfo = new TestWARCRecordInfo(
                TestWARCRecordInfo.buildCompressedHttpResponseBlock(ctype,
                        payload.getBytes(), true));
        recinfo.setMimetype(ctype);
        TestARCReader ar = new TestARCReader(recinfo);
        ARCRecord rec = ar.get(0);
        ArcResource res = new ArcResource(rec, ar);
        res.parseHeaders();
       
        assertEquals("statusCode", 200, res.getStatusCode());
        assertEquals("content-type", ctype, res.getHeader("Content-Type"));
View Full Code Here

Examples of org.archive.io.arc.ARCRecord

      try {
        int status = http.executeMethod(method);
        if(status == 200) {

          ByteArrayInputStream bais = new ByteArrayInputStream(method.getResponseBody());
          ARCRecord r = new ARCRecord(
              new GZIPInputStream(bais),
              "id",0L,false,false,true);
          ArcResource ar = (ArcResource)
            ResourceFactory.ARCArchiveRecordToResource(r, null);
          if(ar.getStatusCode() == 502) {
View Full Code Here

Examples of org.archive.io.arc.ARCRecord

          HttpClient http = new HttpClient(connectionManager);
          http.setHostConfiguration(hostConfiguration);

          int status = http.executeMethod(method);
          if(status == 200) {
            ARCRecord r =
              new ARCRecord(new GZIPInputStream(
                  method.getResponseBodyAsStream()),
                  "id",0L,false,false,true);
            Resource res = null;
            try {
          res = ResourceFactory.ARCArchiveRecordToResource(r, null);
View Full Code Here

Examples of org.archive.io.arc.ARCRecord

      r = (ArcResource) cache.getCachedResource(url, maxCacheMS , false);
    } finally {
      PerfStats.timeEnd(PerfStat.LiveWeb);
    }

    ARCRecord ar = (ARCRecord) r.getArcRecord();
    int status = ar.getStatusCode();
    if ((status == 200) || ((status >= 300) && (status < 400))) {
      result.setCaptureTimestamp(ar.getMetaData().getDate());
      result.setMimeType(ar.getMetaData().getMimetype());
      return r;
    }
   
    return null;
  }
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.