public static BasicCompactHeader newHeader(String name,
String value,
CompactHeaderMapper mapper) {
if (name == null) {
throw new IllegalArgumentException
("The name must not be null.");
}
// value will be checked by constructor later
if (mapper == null)
mapper = BasicCompactHeaderMapper.DEFAULT;
final String altname = mapper.getAlternateName(name);
String fname = name;
String cname = altname;
if ((altname != null) && (name.length() < altname.length())) {
// we were called with the compact name
fname = altname;
cname = name;
}
return new BasicCompactHeader(fname, cname, value);
}
Creates a compact header with automatic lookup. |