@Test public void testMatch() throws Exception { ContentType empty = new ContentType(); assertFalse(empty.match("text/plain")); ContentType plain = new ContentType("text/plain"); assertTrue(plain.match("text/plain")); assertFalse(empty.match(plain)); assertFalse(plain.match(empty)); assertTrue(plain.match("text/*")); ContentType text = new ContentType("text/*"); assertTrue(text.match(plain)); assertTrue(plain.match(text)); }
public boolean match(ContentType cType) { if (!((primaryType == null && cType.getPrimaryType() == null) || (primaryType != null && primaryType.equalsIgnoreCase(cType.getPrimaryType())))) return false; String sType = cType.getSubType(); if ((subType != null && subType.startsWith("*")) || (sType != null && sType.startsWith("*"))) return true; return (subType == null && sType == null) || (subType != null && subType.equalsIgnoreCase(sType)); }
ContentType { public boolean match(ContentType cType) { if (!((primaryType == null && cType.getPrimaryType() == null) || (primaryType != null && primaryType.equalsIgnoreCase(cType.getPrimaryType())))) return false; String sType = cType.getSubType(); if ((subType != null && subType.startsWith("*")) || (sType != null && sType.startsWith("*"))) return true; return (subType == null && sType == null) || (subType != null && subType.equalsIgnoreCase(sType)); } }
ContentType { public boolean match(ContentType cType) { if (!((primaryType == null && cType.getPrimaryType() == null) || (primaryType != null && primaryType.equalsIgnoreCase(cType.getPrimaryType())))) return false; String sType = cType.getSubType(); if ((subType != null && subType.startsWith("*")) || (sType != null && sType.startsWith("*"))) return true; return (subType == null && sType == null) || (subType != null && subType.equalsIgnoreCase(sType)); } ContentType();  ContentType(String primaryType, String subType, 
			ParameterList list);  ContentType(String s); }
ContentType { public boolean match(ContentType cType) { if (!((primaryType == null && cType.getPrimaryType() == null) || (primaryType != null && primaryType.equalsIgnoreCase(cType.getPrimaryType())))) return false; String sType = cType.getSubType(); if ((subType != null && subType.startsWith("*")) || (sType != null && sType.startsWith("*"))) return true; return (subType == null && sType == null) || (subType != null && subType.equalsIgnoreCase(sType)); } ContentType();  ContentType(String primaryType, String subType, 
			ParameterList list);  ContentType(String s); String getPrimaryType(); String getSubType(); String getBaseType(); String getParameter(String name); ParameterList getParameterList(); void setPrimaryType(String primaryType); void setSubType(String subType); void setParameter(String name, String value); void setParameterList(ParameterList list); String toString(); boolean match(ContentType cType); boolean match(String s); }
ContentType { public boolean match(ContentType cType) { if (!((primaryType == null && cType.getPrimaryType() == null) || (primaryType != null && primaryType.equalsIgnoreCase(cType.getPrimaryType())))) return false; String sType = cType.getSubType(); if ((subType != null && subType.startsWith("*")) || (sType != null && sType.startsWith("*"))) return true; return (subType == null && sType == null) || (subType != null && subType.equalsIgnoreCase(sType)); } ContentType();  ContentType(String primaryType, String subType, 
			ParameterList list);  ContentType(String s); String getPrimaryType(); String getSubType(); String getBaseType(); String getParameter(String name); ParameterList getParameterList(); void setPrimaryType(String primaryType); void setSubType(String subType); void setParameter(String name, String value); void setParameterList(ParameterList list); String toString(); boolean match(ContentType cType); boolean match(String s);  }