コード例 #1
0
 private CIProperties getContentRisProperties() {
   CIProperties cProps = new CIProperties();
   // the CU checks the X-Lockss-content-type, not the content-type to determine encoding
   cProps.put(CachedUrl.PROPERTY_CONTENT_TYPE, "text/plain; charset=UTF-8");
   cProps.put("Content-type", "text/plain; charset=UTF-8");
   return cProps;
 }
コード例 #2
0
  public void setUp() throws Exception {
    super.setUp();

    tarHeader = new CIProperties();
    tarHeader.put(CachedUrl.PROPERTY_CONTENT_TYPE, "application/tar");
    tarAu = createTarAu();

    // for tests that also check for content
    els_mle =
        new FileMetadataListExtractor(
            new ElsevierDTD5XmlSourceMetadataExtractorFactory
                .ElsevierDTD5XmlSourceMetadataExtractor());
    // for tests that use a no-check-for-pdf version of the extractor
    nocheck_mle = new FileMetadataListExtractor(new TestElsevierDTD5MetadataExtractor());
    setUpExpectedTarContent();
  }
コード例 #3
0
ファイル: WarcExploder.java プロジェクト: ravn/lockss
  protected CIProperties makeCIProperties(ArchiveRecordHeader elementHeader) throws IOException {
    CIProperties ret = new CIProperties();
    Set elementHeaderFieldKeys = elementHeader.getHeaderFieldKeys();
    for (Iterator i = elementHeaderFieldKeys.iterator(); i.hasNext(); ) {
      String key = (String) i.next();
      try {

        Object valueObject = elementHeader.getHeaderValue(key);

        if (valueObject == null) {
          logger.warning("Ignoring null value for key '" + key + "'.");
        } else {
          String value = valueObject.toString();
          logger.debug3(key + ": " + value);
          ret.put(key, value);
        }

      } catch (ClassCastException ex) {
        logger.error("makeCIProperties: " + key + " threw ", ex);
        throw new CacheException.ExploderException(ex);
      }
    }
    return (ret);
  }