本文整理汇总了Java中com.sun.xml.internal.ws.encoding.ContentType类的典型用法代码示例。如果您正苦于以下问题:Java ContentType类的具体用法?Java ContentType怎么用?Java ContentType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ContentType类属于com.sun.xml.internal.ws.encoding包,在下文中一共展示了ContentType类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: identifyContentType
import com.sun.xml.internal.ws.encoding.ContentType; //导入依赖的package包/类
public static int identifyContentType(ContentType contentType) {
String primary = contentType.getPrimaryType();
String sub = contentType.getSubType();
if (primary.equalsIgnoreCase("multipart") && sub.equalsIgnoreCase("related")) {
String type = contentType.getParameter("type");
if (type != null) {
if (isXMLType(type)) {
return MIME_MULTIPART_FLAG | PLAIN_XML_FLAG;
} else if (isFastInfosetType(type)) {
return MIME_MULTIPART_FLAG | FI_ENCODED_FLAG;
}
}
return 0;
} else if (isXMLType(primary, sub)) {
return PLAIN_XML_FLAG;
} else if (isFastInfosetType(primary, sub)) {
return FI_ENCODED_FLAG;
}
return 0;
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:22,代码来源:XMLMessage.java
示例2: create
import com.sun.xml.internal.ws.encoding.ContentType; //导入依赖的package包/类
public static Message create(final String ct, InputStream in, WSFeatureList f) {
Message data;
try {
in = StreamUtils.hasSomeData(in);
if (in == null) {
return Messages.createEmpty(SOAPVersion.SOAP_11);
}
if (ct != null) {
final ContentType contentType = new ContentType(ct);
final int contentTypeId = identifyContentType(contentType);
if ((contentTypeId & MIME_MULTIPART_FLAG) != 0) {
data = new XMLMultiPart(ct, in, f);
} else if ((contentTypeId & PLAIN_XML_FLAG) != 0) {
data = new XmlContent(ct, in, f);
} else {
data = new UnknownContent(ct, in);
}
} else {
// According to HTTP spec 7.2.1, if the media type remain
// unknown, treat as application/octet-stream
data = new UnknownContent("application/octet-stream", in);
}
} catch(Exception ex) {
throw new WebServiceException(ex);
}
return data;
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:29,代码来源:XMLMessage.java
示例3: getContentId
import com.sun.xml.internal.ws.encoding.ContentType; //导入依赖的package包/类
private static int getContentId(String ct) {
try {
final ContentType contentType = new ContentType(ct);
return identifyContentType(contentType);
} catch(Exception ex) {
throw new WebServiceException(ex);
}
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:9,代码来源:XMLMessage.java
示例4: create
import com.sun.xml.internal.ws.encoding.ContentType; //导入依赖的package包/类
public static Message create(final String ct, InputStream in, WSBinding binding) {
Message data;
try {
in = StreamUtils.hasSomeData(in);
if (in == null) {
return Messages.createEmpty(SOAPVersion.SOAP_11);
}
if (ct != null) {
final ContentType contentType = new ContentType(ct);
final int contentTypeId = identifyContentType(contentType);
if ((contentTypeId & MIME_MULTIPART_FLAG) != 0) {
data = new XMLMultiPart(ct, in, binding);
} else if ((contentTypeId & PLAIN_XML_FLAG) != 0) {
data = new XmlContent(ct, in, binding);
} else {
data = new UnknownContent(ct, in);
}
} else {
// According to HTTP spec 7.2.1, if the media type remain
// unknown, treat as application/octet-stream
data = new UnknownContent("application/octet-stream", in);
}
} catch(Exception ex) {
throw new WebServiceException(ex);
}
return data;
}
开发者ID:alexkasko,项目名称:openjdk-icedtea7,代码行数:29,代码来源:XMLMessage.java
注:本文中的com.sun.xml.internal.ws.encoding.ContentType类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论