com.sun.xml.internal.ws.encoding.ContentType Java Examples

The following examples show how to use com.sun.xml.internal.ws.encoding.ContentType. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: XMLMessage.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
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;
}
 
Example #2
Source File: XMLMessage.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
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;
}
 
Example #3
Source File: XMLMessage.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
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;
}
 
Example #4
Source File: XMLMessage.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
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;
}
 
Example #5
Source File: XMLMessage.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
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;
}
 
Example #6
Source File: XMLMessage.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
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;
}
 
Example #7
Source File: XMLMessage.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
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;
}
 
Example #8
Source File: XMLMessage.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
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;
}
 
Example #9
Source File: XMLMessage.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #10
Source File: XMLMessage.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private static int getContentId(String ct) {
    try {
        final ContentType contentType = new ContentType(ct);
        return identifyContentType(contentType);
    } catch(Exception ex) {
        throw new WebServiceException(ex);
    }
}
 
Example #11
Source File: XMLMessage.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #12
Source File: XMLMessage.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private static int getContentId(String ct) {
    try {
        final ContentType contentType = new ContentType(ct);
        return identifyContentType(contentType);
    } catch(Exception ex) {
        throw new WebServiceException(ex);
    }
}
 
Example #13
Source File: XMLMessage.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #14
Source File: XMLMessage.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private static int getContentId(String ct) {
    try {
        final ContentType contentType = new ContentType(ct);
        return identifyContentType(contentType);
    } catch(Exception ex) {
        throw new WebServiceException(ex);
    }
}
 
Example #15
Source File: XMLMessage.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #16
Source File: XMLMessage.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private static int getContentId(String ct) {
    try {
        final ContentType contentType = new ContentType(ct);
        return identifyContentType(contentType);
    } catch(Exception ex) {
        throw new WebServiceException(ex);
    }
}
 
Example #17
Source File: XMLMessage.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #18
Source File: XMLMessage.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private static int getContentId(String ct) {
    try {
        final ContentType contentType = new ContentType(ct);
        return identifyContentType(contentType);
    } catch(Exception ex) {
        throw new WebServiceException(ex);
    }
}
 
Example #19
Source File: XMLMessage.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #20
Source File: XMLMessage.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private static int getContentId(String ct) {
    try {
        final ContentType contentType = new ContentType(ct);
        return identifyContentType(contentType);
    } catch(Exception ex) {
        throw new WebServiceException(ex);
    }
}
 
Example #21
Source File: XMLMessage.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #22
Source File: XMLMessage.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private static int getContentId(String ct) {
    try {
        final ContentType contentType = new ContentType(ct);
        return identifyContentType(contentType);
    } catch(Exception ex) {
        throw new WebServiceException(ex);
    }
}
 
Example #23
Source File: XMLMessage.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #24
Source File: XMLMessage.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private static int getContentId(String ct) {
    try {
        final ContentType contentType = new ContentType(ct);
        return identifyContentType(contentType);
    } catch(Exception ex) {
        throw new WebServiceException(ex);
    }
}