String v;
if ((v = part.getContentType()) != null) {
// content type as-is
addAttribute("content-type", v);
try {
ContentType ct = new ContentType(v);
String s;
// primary part only
s = ct.getPrimaryType();
if (s != null) {
addAttribute("primary-type", s.toLowerCase());
}
// secondary part only
s = ct.getSubType();
if (s != null) {
addAttribute("secondary-type", s.toLowerCase());
}
// primary part '/' secondary part
s = ct.getBaseType();
if (s != null) {
addAttribute("base-type", s.toLowerCase());
}
// list of parameters : parameter-name parameter-value
ParameterList pl = ct.getParameterList();
Enumeration names = pl.getNames();
while (names.hasMoreElements()) {
String key = (String) names.nextElement();
String value = pl.get(key);
addAttribute(key, value);