public static ParsedMediaType parse(String string) { ParsedMediaType mt = new ParsedMediaType() ; String[] x = WebLib.split(string, ";") ; String[] t = WebLib.split(x[0], "/") ; mt.type = t[0] ; if ( t.length > 1 ) mt.subType = t[1] ; for (int i = 1; i < x.length; i++) { // Each a parameter String z[] = WebLib.split(x[i], "=") ; if ( z.length == 2 ) mt.params.put(z[0], z[1]) ; else log.warn("Duff parameter: " + x[i] + " in " + string) ; } return mt ; }
public static ParsedMediaType parse(String string) { ParsedMediaType mt = new ParsedMediaType() ; String[] x = WebLib.split(string, ";") ; String[] t = WebLib.split(x[0], "/") ; mt.type = t[0] ; if ( t.length > 1 ) mt.subType = t[1] ; for (int i = 1; i < x.length; i++) { // Each a parameter String z[] = WebLib.split(x[i], "=") ; if ( z.length == 2 ) mt.params.put(z[0], z[1]) ; else log.warn("Duff parameter: " + x[i] + " in " + string) ; } return mt ; }