本文整理汇总了Java中org.apache.axis2.transport.http.HTTPConstants.MEDIA_TYPE_APPLICATION_XML属性的典型用法代码示例。如果您正苦于以下问题:Java HTTPConstants.MEDIA_TYPE_APPLICATION_XML属性的具体用法?Java HTTPConstants.MEDIA_TYPE_APPLICATION_XML怎么用?Java HTTPConstants.MEDIA_TYPE_APPLICATION_XML使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.apache.axis2.transport.http.HTTPConstants
的用法示例。
在下文中一共展示了HTTPConstants.MEDIA_TYPE_APPLICATION_XML属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: inferContentType
private String inferContentType(String httpVerb) {
if (httpVerb.trim().equals("GET") || httpVerb.trim().equals("DELETE")) {
return HTTPConstants.MEDIA_TYPE_X_WWW_FORM;
}
return HTTPConstants.MEDIA_TYPE_APPLICATION_XML;
}
示例2: getContentType
public static String getContentType(String contentType, MessageContext msgContext) {
String type;
int index = contentType.indexOf(';');
if (index > 0) {
type = contentType.substring(0, index);
} else {
int commaIndex = contentType.indexOf(',');
if (commaIndex > 0) {
type = contentType.substring(0, commaIndex);
} else {
type = contentType;
}
}
// Some services send REST responces as text/xml. We should convert it to
// application/xml if its a REST response, if not it will try to use the SOAPMessageBuilder.
// isDoingREST should already be properly set by HTTPTransportUtils.initializeMessageContext
if (msgContext.isDoingREST() && HTTPConstants.MEDIA_TYPE_TEXT_XML.equals(type)) {
if (msgContext.isServerSide()) {
if (msgContext.getSoapAction() == null) {
// TODO - remove this logic.
// type = HTTPConstants.MEDIA_TYPE_APPLICATION_XML;
}
} else if (!msgContext.isPropertyTrue(Constants.Configuration.SOAP_RESPONSE_MEP)) {
type = HTTPConstants.MEDIA_TYPE_APPLICATION_XML;
}
}
return type;
}
示例3: getContentTypeForBuilderSelection
private static String getContentTypeForBuilderSelection(String type, MessageContext msgContext) {
/**
* Handle special case where content-type : text/xml and SOAPAction = null consider as
* POX (REST) message not SOAP 1.1.
*
* it's required use the Builder associate with "application/xml" here but should not
* change content type of current message.
*
*/
String cType = type;
if (msgContext.getSoapAction() == null && HTTPConstants.MEDIA_TYPE_TEXT_XML.equals(type) && msgContext.isDoingREST()) {
cType = HTTPConstants.MEDIA_TYPE_APPLICATION_XML;
}
return cType;
}
示例4: getContentTypeForFormatterSelection
private static String getContentTypeForFormatterSelection(String type, MessageContext msgContext) {
/**
* Handle special case where content-type : text/xml and SOAPAction = null consider as
* POX (REST) message not SOAP 1.1.
*
* 1.) it's required use the Builder associate with "application/xml" here but should not
* change content type of current message.
*/
String cType = type;
if (msgContext.isDoingREST() && HTTPConstants.MEDIA_TYPE_TEXT_XML.equals(type)) {
cType = HTTPConstants.MEDIA_TYPE_APPLICATION_XML;
msgContext.setProperty(Constants.Configuration.CONTENT_TYPE, HTTPConstants.MEDIA_TYPE_TEXT_XML);
}
return cType;
}