@Override public String toString() { StringBuffer buf = new StringBuffer(); buf.append("name: ").append(name).append('\n'); buf.append("value: ").append(value).append('\n'); @SuppressWarnings("rawtypes") Enumeration enm = params.getNames(); while (enm.hasMoreElements()) { String pName = (String)enm.nextElement(); buf.append("pname: '" + pName + "' pvalue: '" + params.get(pName) + "'\n"); } return buf.toString(); }
public static ContentType removeCharset(ContentType contentType) { ParameterList orgParamList = contentType.getParameterList(); ParameterList paramList = new ParameterList(); for (Enumeration<?> e = orgParamList.getNames(); e.hasMoreElements(); ) { String name = (String)e.nextElement(); if (!name.equalsIgnoreCase("charset")) { paramList.set(name, orgParamList.get(name)); } } return new ContentType(contentType.getPrimaryType(), contentType.getSubType(), paramList); } }
public static ContentType removeCharset(ContentType contentType) { ParameterList orgParamList = contentType.getParameterList(); ParameterList paramList = new ParameterList(); for (Enumeration<?> e = orgParamList.getNames(); e.hasMoreElements(); ) { String name = (String)e.nextElement(); if (!name.equalsIgnoreCase("charset")) { paramList.set(name, orgParamList.get(name)); } } return new ContentType(contentType.getPrimaryType(), contentType.getSubType(), paramList); } }
public static ContentType addCharset(ContentType contentType, String charset) { ParameterList orgParamList = contentType.getParameterList(); ParameterList paramList = new ParameterList(); if (orgParamList != null) { for (Enumeration<?> e = orgParamList.getNames(); e.hasMoreElements(); ) { String name = (String)e.nextElement(); paramList.set(name, orgParamList.get(name)); } } paramList.set("charset", charset); return new ContentType(contentType.getPrimaryType(), contentType.getSubType(), paramList); }
public static ContentType addCharset(ContentType contentType, String charset) { ParameterList orgParamList = contentType.getParameterList(); ParameterList paramList = new ParameterList(); if (orgParamList != null) { for (Enumeration<?> e = orgParamList.getNames(); e.hasMoreElements(); ) { String name = (String)e.nextElement(); paramList.set(name, orgParamList.get(name)); } } paramList.set("charset", charset); return new ContentType(contentType.getPrimaryType(), contentType.getSubType(), paramList); }