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); }
private void setContents(String s) { contents = s; props.setProperty("Content-Length", "" + s.length()); }
/** * 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); }