Java Code Examples for com.sun.xml.internal.ws.client.ContentNegotiation#none()

The following examples show how to use com.sun.xml.internal.ws.client.ContentNegotiation#none() . 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: SOAPBindingCodec.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public void decode(ReadableByteChannel in, String contentType, Packet packet) {
    if (contentType == null) {
        throw new UnsupportedMediaException();
    }

    preDecode(packet);
    try {
        if(isMultipartRelated(contentType))
            super.decode(in, contentType, packet);
        else if(isFastInfoset(contentType)) {
            if (packet.contentNegotiation == ContentNegotiation.none)
                throw noFastInfosetForDecoding();

            useFastInfosetForEncoding = true;
            fiSoapCodec.decode(in, contentType, packet);
        } else
            xmlSoapCodec.decode(in, contentType, packet);
    } catch(RuntimeException we) {
        if (we instanceof ExceptionHasMessage || we instanceof UnsupportedMediaException) {
            throw we;
        } else {
            throw new MessageCreationException(version, we);
        }
    }
    postDecode(packet);
}
 
Example 2
Source File: SOAPBindingCodec.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
@Override
    protected void decode(MimeMultipartParser mpp, Packet packet) throws IOException {
        // is this SwA or XOP?
        final String rootContentType = mpp.getRootPart().getContentType();
        boolean isMTOM = isApplicationXopXml(rootContentType);
        packet.setMtomRequest(isMTOM);
        if(isMTOM) {
            xmlMtomCodec.decode(mpp,packet);
        } else if (isFastInfoset(rootContentType)) {
            if (packet.contentNegotiation == ContentNegotiation.none)
                throw noFastInfosetForDecoding();

            useFastInfosetForEncoding = true;
            fiSwaCodec.decode(mpp,packet);
        } else if (isXml(rootContentType))
            xmlSwaCodec.decode(mpp,packet);
        else {
            // TODO localize exception
            throw new IOException("");
        }
//        checkDuplicateKnownHeaders(packet);
    }
 
Example 3
Source File: XMLHTTPBindingCodec.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected Codec getMimeRootCodec(Packet p) {
    /**
     * The following logic is only for outbound packets
     * to be encoded by client.
     * On the server the p.contentNegotiation == null.
     */
    if (p.contentNegotiation == ContentNegotiation.none) {
        // The client may have changed the negotiation property from
        // pessismistic to none between invocations
        useFastInfosetForEncoding = false;
    } else if (p.contentNegotiation == ContentNegotiation.optimistic) {
        // Always encode using Fast Infoset if in optimisitic mode
        useFastInfosetForEncoding = true;
    }

    return (useFastInfosetForEncoding && fiCodec != null)? fiCodec : xmlCodec;
}
 
Example 4
Source File: SOAPBindingCodec.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
public void decode(ReadableByteChannel in, String contentType, Packet packet) {
    if (contentType == null) {
        throw new UnsupportedMediaException();
    }

    preDecode(packet);
    try {
        if(isMultipartRelated(contentType))
            super.decode(in, contentType, packet);
        else if(isFastInfoset(contentType)) {
            if (packet.contentNegotiation == ContentNegotiation.none)
                throw noFastInfosetForDecoding();

            useFastInfosetForEncoding = true;
            fiSoapCodec.decode(in, contentType, packet);
        } else
            xmlSoapCodec.decode(in, contentType, packet);
    } catch(RuntimeException we) {
        if (we instanceof ExceptionHasMessage || we instanceof UnsupportedMediaException) {
            throw we;
        } else {
            throw new MessageCreationException(version, we);
        }
    }
    postDecode(packet);
}
 
Example 5
Source File: SOAPBindingCodec.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
public void decode(ReadableByteChannel in, String contentType, Packet packet) {
    if (contentType == null) {
        throw new UnsupportedMediaException();
    }

    preDecode(packet);
    try {
        if(isMultipartRelated(contentType))
            super.decode(in, contentType, packet);
        else if(isFastInfoset(contentType)) {
            if (packet.contentNegotiation == ContentNegotiation.none)
                throw noFastInfosetForDecoding();

            useFastInfosetForEncoding = true;
            fiSoapCodec.decode(in, contentType, packet);
        } else
            xmlSoapCodec.decode(in, contentType, packet);
    } catch(RuntimeException we) {
        if (we instanceof ExceptionHasMessage || we instanceof UnsupportedMediaException) {
            throw we;
        } else {
            throw new MessageCreationException(version, we);
        }
    }
    postDecode(packet);
}
 
Example 6
Source File: SOAPBindingCodec.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
@Override
    protected void decode(MimeMultipartParser mpp, Packet packet) throws IOException {
        // is this SwA or XOP?
        final String rootContentType = mpp.getRootPart().getContentType();
        boolean isMTOM = isApplicationXopXml(rootContentType);
        packet.setMtomRequest(isMTOM);
        if(isMTOM) {
            xmlMtomCodec.decode(mpp,packet);
        } else if (isFastInfoset(rootContentType)) {
            if (packet.contentNegotiation == ContentNegotiation.none)
                throw noFastInfosetForDecoding();

            useFastInfosetForEncoding = true;
            fiSwaCodec.decode(mpp,packet);
        } else if (isXml(rootContentType))
            xmlSwaCodec.decode(mpp,packet);
        else {
            // TODO localize exception
            throw new IOException("");
        }
//        checkDuplicateKnownHeaders(packet);
    }
 
Example 7
Source File: SOAPBindingCodec.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
@Override
    protected void decode(MimeMultipartParser mpp, Packet packet) throws IOException {
        // is this SwA or XOP?
        final String rootContentType = mpp.getRootPart().getContentType();
        boolean isMTOM = isApplicationXopXml(rootContentType);
        packet.setMtomRequest(isMTOM);
        if(isMTOM) {
            xmlMtomCodec.decode(mpp,packet);
        } else if (isFastInfoset(rootContentType)) {
            if (packet.contentNegotiation == ContentNegotiation.none)
                throw noFastInfosetForDecoding();

            useFastInfosetForEncoding = true;
            fiSwaCodec.decode(mpp,packet);
        } else if (isXml(rootContentType))
            xmlSwaCodec.decode(mpp,packet);
        else {
            // TODO localize exception
            throw new IOException("");
        }
//        checkDuplicateKnownHeaders(packet);
    }
 
Example 8
Source File: SOAPBindingCodec.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
public void decode(ReadableByteChannel in, String contentType, Packet packet) {
    if (contentType == null) {
        throw new UnsupportedMediaException();
    }

    preDecode(packet);
    try {
        if(isMultipartRelated(contentType))
            super.decode(in, contentType, packet);
        else if(isFastInfoset(contentType)) {
            if (packet.contentNegotiation == ContentNegotiation.none)
                throw noFastInfosetForDecoding();

            useFastInfosetForEncoding = true;
            fiSoapCodec.decode(in, contentType, packet);
        } else
            xmlSoapCodec.decode(in, contentType, packet);
    } catch(RuntimeException we) {
        if (we instanceof ExceptionHasMessage || we instanceof UnsupportedMediaException) {
            throw we;
        } else {
            throw new MessageCreationException(version, we);
        }
    }
    postDecode(packet);
}
 
Example 9
Source File: SOAPBindingCodec.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public void decode(ReadableByteChannel in, String contentType, Packet packet) {
    if (contentType == null) {
        throw new UnsupportedMediaException();
    }

    preDecode(packet);
    try {
        if(isMultipartRelated(contentType))
            super.decode(in, contentType, packet);
        else if(isFastInfoset(contentType)) {
            if (packet.contentNegotiation == ContentNegotiation.none)
                throw noFastInfosetForDecoding();

            useFastInfosetForEncoding = true;
            fiSoapCodec.decode(in, contentType, packet);
        } else
            xmlSoapCodec.decode(in, contentType, packet);
    } catch(RuntimeException we) {
        if (we instanceof ExceptionHasMessage || we instanceof UnsupportedMediaException) {
            throw we;
        } else {
            throw new MessageCreationException(version, we);
        }
    }
    postDecode(packet);
}
 
Example 10
Source File: SOAPBindingCodec.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
@Override
    protected void decode(MimeMultipartParser mpp, Packet packet) throws IOException {
        // is this SwA or XOP?
        final String rootContentType = mpp.getRootPart().getContentType();
        boolean isMTOM = isApplicationXopXml(rootContentType);
        packet.setMtomRequest(isMTOM);
        if(isMTOM) {
            xmlMtomCodec.decode(mpp,packet);
        } else if (isFastInfoset(rootContentType)) {
            if (packet.contentNegotiation == ContentNegotiation.none)
                throw noFastInfosetForDecoding();

            useFastInfosetForEncoding = true;
            fiSwaCodec.decode(mpp,packet);
        } else if (isXml(rootContentType))
            xmlSwaCodec.decode(mpp,packet);
        else {
            // TODO localize exception
            throw new IOException("");
        }
//        checkDuplicateKnownHeaders(packet);
    }
 
Example 11
Source File: SOAPBindingCodec.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private ContentTypeImpl setAcceptHeader(Packet p, ContentTypeImpl c) {
    String _accept;
    if (!ignoreContentNegotiationProperty && p.contentNegotiation != ContentNegotiation.none) {
        _accept = connegXmlAccept;
    } else {
        _accept = xmlAccept;
    }
    c.setAcceptHeader(_accept);
    return c;
}
 
Example 12
Source File: SOAPBindingCodec.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private ContentTypeImpl setAcceptHeader(Packet p, ContentTypeImpl c) {
    String _accept;
    if (!ignoreContentNegotiationProperty && p.contentNegotiation != ContentNegotiation.none) {
        _accept = connegXmlAccept;
    } else {
        _accept = xmlAccept;
    }
    c.setAcceptHeader(_accept);
    return c;
}
 
Example 13
Source File: SOAPBindingCodec.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public void decode(InputStream in, String contentType, Packet packet) throws IOException {
    if (contentType == null) {
        contentType = xmlMimeType;
    }
    packet.setContentType(new ContentTypeImpl(contentType));
    preDecode(packet);
    try {
        if(isMultipartRelated(contentType))
            // parse the multipart portion and then decide whether it's MTOM or SwA
            super.decode(in, contentType, packet);
        else if(isFastInfoset(contentType)) {
            if (!ignoreContentNegotiationProperty && packet.contentNegotiation == ContentNegotiation.none)
                throw noFastInfosetForDecoding();

            useFastInfosetForEncoding = true;
            fiSoapCodec.decode(in, contentType, packet);
        } else
            xmlSoapCodec.decode(in, contentType, packet);
    } catch(RuntimeException we) {
        if (we instanceof ExceptionHasMessage || we instanceof UnsupportedMediaException) {
            throw we;
        } else {
            throw new MessageCreationException(version, we);
        }
    }
    postDecode(packet);
}
 
Example 14
Source File: SOAPBindingCodec.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public void decode(InputStream in, String contentType, Packet packet) throws IOException {
    if (contentType == null) {
        contentType = xmlMimeType;
    }
    packet.setContentType(new ContentTypeImpl(contentType));
    preDecode(packet);
    try {
        if(isMultipartRelated(contentType))
            // parse the multipart portion and then decide whether it's MTOM or SwA
            super.decode(in, contentType, packet);
        else if(isFastInfoset(contentType)) {
            if (!ignoreContentNegotiationProperty && packet.contentNegotiation == ContentNegotiation.none)
                throw noFastInfosetForDecoding();

            useFastInfosetForEncoding = true;
            fiSoapCodec.decode(in, contentType, packet);
        } else
            xmlSoapCodec.decode(in, contentType, packet);
    } catch(RuntimeException we) {
        if (we instanceof ExceptionHasMessage || we instanceof UnsupportedMediaException) {
            throw we;
        } else {
            throw new MessageCreationException(version, we);
        }
    }
    postDecode(packet);
}
 
Example 15
Source File: SOAPBindingCodec.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public void decode(InputStream in, String contentType, Packet packet) throws IOException {
    if (contentType == null) {
        contentType = xmlMimeType;
    }
    packet.setContentType(new ContentTypeImpl(contentType));
    preDecode(packet);
    try {
        if(isMultipartRelated(contentType))
            // parse the multipart portion and then decide whether it's MTOM or SwA
            super.decode(in, contentType, packet);
        else if(isFastInfoset(contentType)) {
            if (!ignoreContentNegotiationProperty && packet.contentNegotiation == ContentNegotiation.none)
                throw noFastInfosetForDecoding();

            useFastInfosetForEncoding = true;
            fiSoapCodec.decode(in, contentType, packet);
        } else
            xmlSoapCodec.decode(in, contentType, packet);
    } catch(RuntimeException we) {
        if (we instanceof ExceptionHasMessage || we instanceof UnsupportedMediaException) {
            throw we;
        } else {
            throw new MessageCreationException(version, we);
        }
    }
    postDecode(packet);
}
 
Example 16
Source File: SOAPBindingCodec.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private ContentTypeImpl setAcceptHeader(Packet p, ContentTypeImpl c) {
    String _accept;
    if (!ignoreContentNegotiationProperty && p.contentNegotiation != ContentNegotiation.none) {
        _accept = connegXmlAccept;
    } else {
        _accept = xmlAccept;
    }
    c.setAcceptHeader(_accept);
    return c;
}
 
Example 17
Source File: SOAPBindingCodec.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public void decode(InputStream in, String contentType, Packet packet) throws IOException {
    if (contentType == null) {
        contentType = xmlMimeType;
    }
    packet.setContentType(new ContentTypeImpl(contentType));
    preDecode(packet);
    try {
        if(isMultipartRelated(contentType))
            // parse the multipart portion and then decide whether it's MTOM or SwA
            super.decode(in, contentType, packet);
        else if(isFastInfoset(contentType)) {
            if (!ignoreContentNegotiationProperty && packet.contentNegotiation == ContentNegotiation.none)
                throw noFastInfosetForDecoding();

            useFastInfosetForEncoding = true;
            fiSoapCodec.decode(in, contentType, packet);
        } else
            xmlSoapCodec.decode(in, contentType, packet);
    } catch(RuntimeException we) {
        if (we instanceof ExceptionHasMessage || we instanceof UnsupportedMediaException) {
            throw we;
        } else {
            throw new MessageCreationException(version, we);
        }
    }
    postDecode(packet);
}
 
Example 18
Source File: SOAPBindingCodec.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public void decode(InputStream in, String contentType, Packet packet) throws IOException {
    if (contentType == null) {
        contentType = xmlMimeType;
    }
    packet.setContentType(new ContentTypeImpl(contentType));
    preDecode(packet);
    try {
        if(isMultipartRelated(contentType))
            // parse the multipart portion and then decide whether it's MTOM or SwA
            super.decode(in, contentType, packet);
        else if(isFastInfoset(contentType)) {
            if (!ignoreContentNegotiationProperty && packet.contentNegotiation == ContentNegotiation.none)
                throw noFastInfosetForDecoding();

            useFastInfosetForEncoding = true;
            fiSoapCodec.decode(in, contentType, packet);
        } else
            xmlSoapCodec.decode(in, contentType, packet);
    } catch(RuntimeException we) {
        if (we instanceof ExceptionHasMessage || we instanceof UnsupportedMediaException) {
            throw we;
        } else {
            throw new MessageCreationException(version, we);
        }
    }
    postDecode(packet);
}
 
Example 19
Source File: SOAPBindingCodec.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private ContentTypeImpl setAcceptHeader(Packet p, ContentTypeImpl c) {
    String _accept;
    if (!ignoreContentNegotiationProperty && p.contentNegotiation != ContentNegotiation.none) {
        _accept = connegXmlAccept;
    } else {
        _accept = xmlAccept;
    }
    c.setAcceptHeader(_accept);
    return c;
}
 
Example 20
Source File: SOAPBindingCodec.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public void decode(InputStream in, String contentType, Packet packet) throws IOException {
    if (contentType == null) {
        contentType = xmlMimeType;
    }
    packet.setContentType(new ContentTypeImpl(contentType));
    preDecode(packet);
    try {
        if(isMultipartRelated(contentType))
            // parse the multipart portion and then decide whether it's MTOM or SwA
            super.decode(in, contentType, packet);
        else if(isFastInfoset(contentType)) {
            if (!ignoreContentNegotiationProperty && packet.contentNegotiation == ContentNegotiation.none)
                throw noFastInfosetForDecoding();

            useFastInfosetForEncoding = true;
            fiSoapCodec.decode(in, contentType, packet);
        } else
            xmlSoapCodec.decode(in, contentType, packet);
    } catch(RuntimeException we) {
        if (we instanceof ExceptionHasMessage || we instanceof UnsupportedMediaException) {
            throw we;
        } else {
            throw new MessageCreationException(version, we);
        }
    }
    postDecode(packet);
}