本文整理汇总了Java中com.epam.reportportal.apache.http.entity.ContentType.parse方法的典型用法代码示例。如果您正苦于以下问题:Java ContentType.parse方法的具体用法?Java ContentType.parse怎么用?Java ContentType.parse使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.epam.reportportal.apache.http.entity.ContentType
的用法示例。
在下文中一共展示了ContentType.parse方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testParse
import com.epam.reportportal.apache.http.entity.ContentType; //导入方法依赖的package包/类
@Test
public void testParse() throws Exception {
final ContentType contentType = ContentType.parse("text/plain; charset=\"ascii\"");
Assert.assertEquals("text/plain", contentType.getMimeType());
Assert.assertEquals("US-ASCII", contentType.getCharset().name());
Assert.assertEquals("text/plain; charset=ascii", contentType.toString());
}
示例2: testParseMultiparam
import com.epam.reportportal.apache.http.entity.ContentType; //导入方法依赖的package包/类
@Test
public void testParseMultiparam() throws Exception {
final ContentType contentType = ContentType.parse("text/plain; charset=\"ascii\"; " +
"p0 ; p1 = \"blah-blah\" ; p2 = \" yada yada \" ");
Assert.assertEquals("text/plain", contentType.getMimeType());
Assert.assertEquals("US-ASCII", contentType.getCharset().name());
Assert.assertEquals("text/plain; charset=ascii; p0; p1=blah-blah; p2=\" yada yada \"",
contentType.toString());
Assert.assertEquals(null, contentType.getParameter("p0"));
Assert.assertEquals("blah-blah", contentType.getParameter("p1"));
Assert.assertEquals(" yada yada ", contentType.getParameter("p2"));
Assert.assertEquals(null, contentType.getParameter("p3"));
}
示例3: AbstractContentBody
import com.epam.reportportal.apache.http.entity.ContentType; //导入方法依赖的package包/类
/**
* @deprecated (4.3) use {@link AbstractContentBody#AbstractContentBody(ContentType)}
*/
@Deprecated
public AbstractContentBody(final String mimeType) {
this(ContentType.parse(mimeType));
}
示例4: testParseEmptyCharset
import com.epam.reportportal.apache.http.entity.ContentType; //导入方法依赖的package包/类
@Test
public void testParseEmptyCharset() throws Exception {
final ContentType contentType = ContentType.parse("text/plain; charset=\" \"");
Assert.assertEquals("text/plain", contentType.getMimeType());
Assert.assertEquals(null, contentType.getCharset());
}