Java Code Examples for com.sun.xml.internal.ws.api.message.Packet#setMtomFeature()

The following examples show how to use com.sun.xml.internal.ws.api.message.Packet#setMtomFeature() . 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: MtomCodec.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected void decode(MimeMultipartParser mpp, Packet packet) throws IOException {
    //TODO shouldn't we check for SOAP1.1/SOAP1.2 and throw
    //TODO UnsupportedMediaException like StreamSOAPCodec
    String charset = null;
    String ct = mpp.getRootPart().getContentType();
    if (ct != null) {
        charset = new ContentTypeImpl(ct).getCharSet();
    }
    if (charset != null && !Charset.isSupported(charset)) {
        throw new UnsupportedMediaException(charset);
    }

    if (charset != null) {
        packet.invocationProperties.put(DECODED_MESSAGE_CHARSET, charset);
    } else {
        packet.invocationProperties.remove(DECODED_MESSAGE_CHARSET);
    }

    // we'd like to reuse those reader objects but unfortunately decoder may be reused
    // before the decoded message is completely used.
    XMLStreamReader mtomReader = new MtomXMLStreamReaderEx( mpp,
        XMLStreamReaderFactory.create(null, mpp.getRootPart().asInputStream(), charset, true)
    );

    packet.setMessage(codec.decode(mtomReader, new MimeAttachmentSet(mpp)));
    packet.setMtomFeature(mtomFeature);
    packet.setContentType(mpp.getContentType());
}
 
Example 2
Source File: SOAPBindingCodec.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
     * Should be called after decode().
     * Set the state so that such state is used by encode().
     */
    private void postDecode(Packet p) {
        p.setFastInfosetDisabled(isFastInfosetDisabled);
        if(features.isEnabled(MTOMFeature.class)) p.checkMtomAcceptable();
//            p.setMtomAcceptable( isMtomAcceptable(p.acceptableMimeTypes) );
        MTOMFeature mtomFeature = features.get(MTOMFeature.class);
        if (mtomFeature != null) {
            p.setMtomFeature(mtomFeature);
        }
        if (!useFastInfosetForEncoding) {
            useFastInfosetForEncoding = p.getFastInfosetAcceptable(fiMimeType);
//          useFastInfosetForEncoding = isFastInfosetAcceptable(p.acceptableMimeTypes);
        }
    }
 
Example 3
Source File: MtomCodec.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected void decode(MimeMultipartParser mpp, Packet packet) throws IOException {
    //TODO shouldn't we check for SOAP1.1/SOAP1.2 and throw
    //TODO UnsupportedMediaException like StreamSOAPCodec
    String charset = null;
    String ct = mpp.getRootPart().getContentType();
    if (ct != null) {
        charset = new ContentTypeImpl(ct).getCharSet();
    }
    if (charset != null && !Charset.isSupported(charset)) {
        throw new UnsupportedMediaException(charset);
    }

    if (charset != null) {
        packet.invocationProperties.put(DECODED_MESSAGE_CHARSET, charset);
    } else {
        packet.invocationProperties.remove(DECODED_MESSAGE_CHARSET);
    }

    // we'd like to reuse those reader objects but unfortunately decoder may be reused
    // before the decoded message is completely used.
    XMLStreamReader mtomReader = new MtomXMLStreamReaderEx( mpp,
        XMLStreamReaderFactory.create(null, mpp.getRootPart().asInputStream(), charset, true)
    );

    packet.setMessage(codec.decode(mtomReader, new MimeAttachmentSet(mpp)));
    packet.setMtomFeature(mtomFeature);
    packet.setContentType(mpp.getContentType());
}
 
Example 4
Source File: SOAPBindingCodec.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
     * Should be called after decode().
     * Set the state so that such state is used by encode().
     */
    private void postDecode(Packet p) {
        p.setFastInfosetDisabled(isFastInfosetDisabled);
        if(features.isEnabled(MTOMFeature.class)) p.checkMtomAcceptable();
//            p.setMtomAcceptable( isMtomAcceptable(p.acceptableMimeTypes) );
        MTOMFeature mtomFeature = features.get(MTOMFeature.class);
        if (mtomFeature != null) {
            p.setMtomFeature(mtomFeature);
        }
        if (!useFastInfosetForEncoding) {
            useFastInfosetForEncoding = p.getFastInfosetAcceptable(fiMimeType);
//          useFastInfosetForEncoding = isFastInfosetAcceptable(p.acceptableMimeTypes);
        }
    }
 
Example 5
Source File: MtomCodec.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected void decode(MimeMultipartParser mpp, Packet packet) throws IOException {
    //TODO shouldn't we check for SOAP1.1/SOAP1.2 and throw
    //TODO UnsupportedMediaException like StreamSOAPCodec
    String charset = null;
    String ct = mpp.getRootPart().getContentType();
    if (ct != null) {
        charset = new ContentTypeImpl(ct).getCharSet();
    }
    if (charset != null && !Charset.isSupported(charset)) {
        throw new UnsupportedMediaException(charset);
    }

    if (charset != null) {
        packet.invocationProperties.put(DECODED_MESSAGE_CHARSET, charset);
    } else {
        packet.invocationProperties.remove(DECODED_MESSAGE_CHARSET);
    }

    // we'd like to reuse those reader objects but unfortunately decoder may be reused
    // before the decoded message is completely used.
    XMLStreamReader mtomReader = new MtomXMLStreamReaderEx( mpp,
        XMLStreamReaderFactory.create(null, mpp.getRootPart().asInputStream(), charset, true)
    );

    packet.setMessage(codec.decode(mtomReader, new MimeAttachmentSet(mpp)));
    packet.setMtomFeature(mtomFeature);
    packet.setContentType(mpp.getContentType());
}
 
Example 6
Source File: SOAPBindingCodec.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
     * Should be called after decode().
     * Set the state so that such state is used by encode().
     */
    private void postDecode(Packet p) {
        p.setFastInfosetDisabled(isFastInfosetDisabled);
        if(features.isEnabled(MTOMFeature.class)) p.checkMtomAcceptable();
//            p.setMtomAcceptable( isMtomAcceptable(p.acceptableMimeTypes) );
        MTOMFeature mtomFeature = features.get(MTOMFeature.class);
        if (mtomFeature != null) {
            p.setMtomFeature(mtomFeature);
        }
        if (!useFastInfosetForEncoding) {
            useFastInfosetForEncoding = p.getFastInfosetAcceptable(fiMimeType);
//          useFastInfosetForEncoding = isFastInfosetAcceptable(p.acceptableMimeTypes);
        }
    }
 
Example 7
Source File: MtomCodec.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected void decode(MimeMultipartParser mpp, Packet packet) throws IOException {
    //TODO shouldn't we check for SOAP1.1/SOAP1.2 and throw
    //TODO UnsupportedMediaException like StreamSOAPCodec
    String charset = null;
    String ct = mpp.getRootPart().getContentType();
    if (ct != null) {
        charset = new ContentTypeImpl(ct).getCharSet();
    }
    if (charset != null && !Charset.isSupported(charset)) {
        throw new UnsupportedMediaException(charset);
    }

    if (charset != null) {
        packet.invocationProperties.put(DECODED_MESSAGE_CHARSET, charset);
    } else {
        packet.invocationProperties.remove(DECODED_MESSAGE_CHARSET);
    }

    // we'd like to reuse those reader objects but unfortunately decoder may be reused
    // before the decoded message is completely used.
    XMLStreamReader mtomReader = new MtomXMLStreamReaderEx( mpp,
        XMLStreamReaderFactory.create(null, mpp.getRootPart().asInputStream(), charset, true)
    );

    packet.setMessage(codec.decode(mtomReader, new MimeAttachmentSet(mpp)));
    packet.setMtomFeature(mtomFeature);
    packet.setContentType(mpp.getContentType());
}
 
Example 8
Source File: SOAPBindingCodec.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
     * Should be called after decode().
     * Set the state so that such state is used by encode().
     */
    private void postDecode(Packet p) {
        p.setFastInfosetDisabled(isFastInfosetDisabled);
        if(features.isEnabled(MTOMFeature.class)) p.checkMtomAcceptable();
//            p.setMtomAcceptable( isMtomAcceptable(p.acceptableMimeTypes) );
        MTOMFeature mtomFeature = features.get(MTOMFeature.class);
        if (mtomFeature != null) {
            p.setMtomFeature(mtomFeature);
        }
        if (!useFastInfosetForEncoding) {
            useFastInfosetForEncoding = p.getFastInfosetAcceptable(fiMimeType);
//          useFastInfosetForEncoding = isFastInfosetAcceptable(p.acceptableMimeTypes);
        }
    }
 
Example 9
Source File: MtomCodec.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected void decode(MimeMultipartParser mpp, Packet packet) throws IOException {
    //TODO shouldn't we check for SOAP1.1/SOAP1.2 and throw
    //TODO UnsupportedMediaException like StreamSOAPCodec
    String charset = null;
    String ct = mpp.getRootPart().getContentType();
    if (ct != null) {
        charset = new ContentTypeImpl(ct).getCharSet();
    }
    if (charset != null && !Charset.isSupported(charset)) {
        throw new UnsupportedMediaException(charset);
    }

    if (charset != null) {
        packet.invocationProperties.put(DECODED_MESSAGE_CHARSET, charset);
    } else {
        packet.invocationProperties.remove(DECODED_MESSAGE_CHARSET);
    }

    // we'd like to reuse those reader objects but unfortunately decoder may be reused
    // before the decoded message is completely used.
    XMLStreamReader mtomReader = new MtomXMLStreamReaderEx( mpp,
        XMLStreamReaderFactory.create(null, mpp.getRootPart().asInputStream(), charset, true)
    );

    packet.setMessage(codec.decode(mtomReader, new MimeAttachmentSet(mpp)));
    packet.setMtomFeature(mtomFeature);
    packet.setContentType(mpp.getContentType());
}
 
Example 10
Source File: SOAPBindingCodec.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
     * Should be called after decode().
     * Set the state so that such state is used by encode().
     */
    private void postDecode(Packet p) {
        p.setFastInfosetDisabled(isFastInfosetDisabled);
        if(features.isEnabled(MTOMFeature.class)) p.checkMtomAcceptable();
//            p.setMtomAcceptable( isMtomAcceptable(p.acceptableMimeTypes) );
        MTOMFeature mtomFeature = features.get(MTOMFeature.class);
        if (mtomFeature != null) {
            p.setMtomFeature(mtomFeature);
        }
        if (!useFastInfosetForEncoding) {
            useFastInfosetForEncoding = p.getFastInfosetAcceptable(fiMimeType);
//          useFastInfosetForEncoding = isFastInfosetAcceptable(p.acceptableMimeTypes);
        }
    }
 
Example 11
Source File: MtomCodec.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected void decode(MimeMultipartParser mpp, Packet packet) throws IOException {
    //TODO shouldn't we check for SOAP1.1/SOAP1.2 and throw
    //TODO UnsupportedMediaException like StreamSOAPCodec
    String charset = null;
    String ct = mpp.getRootPart().getContentType();
    if (ct != null) {
        charset = new ContentTypeImpl(ct).getCharSet();
    }
    if (charset != null && !Charset.isSupported(charset)) {
        throw new UnsupportedMediaException(charset);
    }

    if (charset != null) {
        packet.invocationProperties.put(DECODED_MESSAGE_CHARSET, charset);
    } else {
        packet.invocationProperties.remove(DECODED_MESSAGE_CHARSET);
    }

    // we'd like to reuse those reader objects but unfortunately decoder may be reused
    // before the decoded message is completely used.
    XMLStreamReader mtomReader = new MtomXMLStreamReaderEx( mpp,
        XMLStreamReaderFactory.create(null, mpp.getRootPart().asInputStream(), charset, true)
    );

    packet.setMessage(codec.decode(mtomReader, new MimeAttachmentSet(mpp)));
    packet.setMtomFeature(mtomFeature);
    packet.setContentType(mpp.getContentType());
}
 
Example 12
Source File: SOAPBindingCodec.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
     * Should be called after decode().
     * Set the state so that such state is used by encode().
     */
    private void postDecode(Packet p) {
        p.setFastInfosetDisabled(isFastInfosetDisabled);
        if(features.isEnabled(MTOMFeature.class)) p.checkMtomAcceptable();
//            p.setMtomAcceptable( isMtomAcceptable(p.acceptableMimeTypes) );
        MTOMFeature mtomFeature = features.get(MTOMFeature.class);
        if (mtomFeature != null) {
            p.setMtomFeature(mtomFeature);
        }
        if (!useFastInfosetForEncoding) {
            useFastInfosetForEncoding = p.getFastInfosetAcceptable(fiMimeType);
//          useFastInfosetForEncoding = isFastInfosetAcceptable(p.acceptableMimeTypes);
        }
    }
 
Example 13
Source File: MtomCodec.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected void decode(MimeMultipartParser mpp, Packet packet) throws IOException {
    //TODO shouldn't we check for SOAP1.1/SOAP1.2 and throw
    //TODO UnsupportedMediaException like StreamSOAPCodec
    String charset = null;
    String ct = mpp.getRootPart().getContentType();
    if (ct != null) {
        charset = new ContentTypeImpl(ct).getCharSet();
    }
    if (charset != null && !Charset.isSupported(charset)) {
        throw new UnsupportedMediaException(charset);
    }

    if (charset != null) {
        packet.invocationProperties.put(DECODED_MESSAGE_CHARSET, charset);
    } else {
        packet.invocationProperties.remove(DECODED_MESSAGE_CHARSET);
    }

    // we'd like to reuse those reader objects but unfortunately decoder may be reused
    // before the decoded message is completely used.
    XMLStreamReader mtomReader = new MtomXMLStreamReaderEx( mpp,
        XMLStreamReaderFactory.create(null, mpp.getRootPart().asInputStream(), charset, true)
    );

    packet.setMessage(codec.decode(mtomReader, new MimeAttachmentSet(mpp)));
    packet.setMtomFeature(mtomFeature);
    packet.setContentType(mpp.getContentType());
}
 
Example 14
Source File: SOAPBindingCodec.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
     * Should be called after decode().
     * Set the state so that such state is used by encode().
     */
    private void postDecode(Packet p) {
        p.setFastInfosetDisabled(isFastInfosetDisabled);
        if(features.isEnabled(MTOMFeature.class)) p.checkMtomAcceptable();
//            p.setMtomAcceptable( isMtomAcceptable(p.acceptableMimeTypes) );
        MTOMFeature mtomFeature = features.get(MTOMFeature.class);
        if (mtomFeature != null) {
            p.setMtomFeature(mtomFeature);
        }
        if (!useFastInfosetForEncoding) {
            useFastInfosetForEncoding = p.getFastInfosetAcceptable(fiMimeType);
//          useFastInfosetForEncoding = isFastInfosetAcceptable(p.acceptableMimeTypes);
        }
    }
 
Example 15
Source File: MtomCodec.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected void decode(MimeMultipartParser mpp, Packet packet) throws IOException {
    //TODO shouldn't we check for SOAP1.1/SOAP1.2 and throw
    //TODO UnsupportedMediaException like StreamSOAPCodec
    String charset = null;
    String ct = mpp.getRootPart().getContentType();
    if (ct != null) {
        charset = new ContentTypeImpl(ct).getCharSet();
    }
    if (charset != null && !Charset.isSupported(charset)) {
        throw new UnsupportedMediaException(charset);
    }

    if (charset != null) {
        packet.invocationProperties.put(DECODED_MESSAGE_CHARSET, charset);
    } else {
        packet.invocationProperties.remove(DECODED_MESSAGE_CHARSET);
    }

    // we'd like to reuse those reader objects but unfortunately decoder may be reused
    // before the decoded message is completely used.
    XMLStreamReader mtomReader = new MtomXMLStreamReaderEx( mpp,
        XMLStreamReaderFactory.create(null, mpp.getRootPart().asInputStream(), charset, true)
    );

    packet.setMessage(codec.decode(mtomReader, new MimeAttachmentSet(mpp)));
    packet.setMtomFeature(mtomFeature);
    packet.setContentType(mpp.getContentType());
}
 
Example 16
Source File: SOAPBindingCodec.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
     * Should be called after decode().
     * Set the state so that such state is used by encode().
     */
    private void postDecode(Packet p) {
        p.setFastInfosetDisabled(isFastInfosetDisabled);
        if(features.isEnabled(MTOMFeature.class)) p.checkMtomAcceptable();
//            p.setMtomAcceptable( isMtomAcceptable(p.acceptableMimeTypes) );
        MTOMFeature mtomFeature = features.get(MTOMFeature.class);
        if (mtomFeature != null) {
            p.setMtomFeature(mtomFeature);
        }
        if (!useFastInfosetForEncoding) {
            useFastInfosetForEncoding = p.getFastInfosetAcceptable(fiMimeType);
//          useFastInfosetForEncoding = isFastInfosetAcceptable(p.acceptableMimeTypes);
        }
    }