コード例 #1
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);
  }
コード例 #2
0
 private void setContents(String s) {
   contents = s;
   props.setProperty("Content-Length", "" + s.length());
 }
コード例 #3
0
 /**
  * Create a CachedUrl with content
  *
  * @param owner the CUS owner
  * @param url the url
  * @param type the type
  * @param contents the contents
  */
 public SCU(CachedUrlSet owner, String url, String type, String contents) {
   this(owner, url);
   setContents(contents);
   props.setProperty(CachedUrl.PROPERTY_CONTENT_TYPE, type);
 }