Java Code Examples for com.sun.xml.internal.ws.api.message.Packet#setMessage()
The following examples show how to use
com.sun.xml.internal.ws.api.message.Packet#setMessage() .
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: StreamSOAPCodec.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
public void decode(InputStream in, String contentType, Packet packet, AttachmentSet att ) throws IOException { List<String> expectedContentTypes = getExpectedContentTypes(); if (contentType != null && !isContentTypeSupported(contentType,expectedContentTypes)) { throw new UnsupportedMediaException(contentType, expectedContentTypes); } com.oracle.webservices.internal.api.message.ContentType pct = packet.getInternalContentType(); ContentTypeImpl cti = (pct != null && pct instanceof ContentTypeImpl) ? (ContentTypeImpl)pct : new ContentTypeImpl(contentType); String charset = cti.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); } packet.setMessage(streamDecoder.decode(in, charset, att, soapVersion)); }
Example 2
Source File: StreamSOAPCodec.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
public void decode(InputStream in, String contentType, Packet packet, AttachmentSet att ) throws IOException { List<String> expectedContentTypes = getExpectedContentTypes(); if (contentType != null && !isContentTypeSupported(contentType,expectedContentTypes)) { throw new UnsupportedMediaException(contentType, expectedContentTypes); } com.oracle.webservices.internal.api.message.ContentType pct = packet.getInternalContentType(); ContentTypeImpl cti = (pct != null && pct instanceof ContentTypeImpl) ? (ContentTypeImpl)pct : new ContentTypeImpl(contentType); String charset = cti.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); } packet.setMessage(streamDecoder.decode(in, charset, att, soapVersion)); }
Example 3
Source File: StreamSOAPCodec.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
public void decode(InputStream in, String contentType, Packet packet, AttachmentSet att ) throws IOException { List<String> expectedContentTypes = getExpectedContentTypes(); if (contentType != null && !isContentTypeSupported(contentType,expectedContentTypes)) { throw new UnsupportedMediaException(contentType, expectedContentTypes); } com.oracle.webservices.internal.api.message.ContentType pct = packet.getInternalContentType(); ContentTypeImpl cti = (pct != null && pct instanceof ContentTypeImpl) ? (ContentTypeImpl)pct : new ContentTypeImpl(contentType); String charset = cti.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); } packet.setMessage(streamDecoder.decode(in, charset, att, soapVersion)); }
Example 4
Source File: MtomCodec.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
@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 5
Source File: XMLHTTPBindingCodec.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
@Override public void decode(InputStream in, String contentType, Packet packet) throws IOException { /** * Reset the encoding state when on the server side for each * decode/encode step. */ if (packet.contentNegotiation == null) useFastInfosetForEncoding = false; if (contentType == null) { xmlCodec.decode(in, contentType, packet); } else if (isMultipartRelated(contentType)) { packet.setMessage(new XMLMultiPart(contentType, in, features)); } else if(isFastInfoset(contentType)) { if (fiCodec == null) { throw new RuntimeException(StreamingMessages.FASTINFOSET_NO_IMPLEMENTATION()); } useFastInfosetForEncoding = true; fiCodec.decode(in, contentType, packet); } else if (isXml(contentType)) { xmlCodec.decode(in, contentType, packet); } else { packet.setMessage(new UnknownContent(contentType, in)); } if (!useFastInfosetForEncoding) { useFastInfosetForEncoding = isFastInfosetAcceptable(packet.acceptableMimeTypes); } }
Example 6
Source File: XMLHTTPBindingCodec.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
@Override public void decode(InputStream in, String contentType, Packet packet) throws IOException { /** * Reset the encoding state when on the server side for each * decode/encode step. */ if (packet.contentNegotiation == null) useFastInfosetForEncoding = false; if (contentType == null) { xmlCodec.decode(in, contentType, packet); } else if (isMultipartRelated(contentType)) { packet.setMessage(new XMLMultiPart(contentType, in, features)); } else if(isFastInfoset(contentType)) { if (fiCodec == null) { throw new RuntimeException(StreamingMessages.FASTINFOSET_NO_IMPLEMENTATION()); } useFastInfosetForEncoding = true; fiCodec.decode(in, contentType, packet); } else if (isXml(contentType)) { xmlCodec.decode(in, contentType, packet); } else { packet.setMessage(new UnknownContent(contentType, in)); } if (!useFastInfosetForEncoding) { useFastInfosetForEncoding = isFastInfosetAcceptable(packet.acceptableMimeTypes); } }
Example 7
Source File: FastInfosetCodec.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
public void decode(InputStream in, String contentType, Packet packet) throws IOException { /* Implements similar logic as the XMLMessage.create(String, InputStream). * But it's faster, as we know the InputStream has FastInfoset content*/ Message message; in = hasSomeData(in); if (in != null) { message = Messages.createUsingPayload(new FastInfosetSource(in), SOAPVersion.SOAP_11); } else { message = Messages.createEmpty(SOAPVersion.SOAP_11); } packet.setMessage(message); }
Example 8
Source File: MtomCodec.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
@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 9
Source File: MtomCodec.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
@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: MtomCodec.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
@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 11
Source File: FastInfosetStreamSOAPCodec.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
public void decode(InputStream in, String contentType, Packet response) throws IOException { response.setMessage( _soapCodec.decode(getXMLStreamReader(in))); }
Example 12
Source File: XMLCodec.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
public void decode(InputStream in, String contentType, Packet packet) throws IOException { Message message = XMLMessage.create(contentType, in, features); packet.setMessage(message); }
Example 13
Source File: FastInfosetStreamSOAPCodec.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
public void decode(InputStream in, String contentType, Packet response) throws IOException { response.setMessage( _soapCodec.decode(getXMLStreamReader(in))); }
Example 14
Source File: XMLCodec.java From hottub with GNU General Public License v2.0 | 4 votes |
public void decode(InputStream in, String contentType, Packet packet) throws IOException { Message message = XMLMessage.create(contentType, in, features); packet.setMessage(message); }
Example 15
Source File: HandlerTube.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
@Override public NextAction processRequest(Packet request) { setupExchange(); // This check is done to cover handler returning false in Oneway request if (isHandleFalse()) { // Cousin HandlerTube returned false during Oneway Request processing. // Don't call handlers and dispatch the message. remedyActionTaken = true; return doInvoke(super.next, request); } // This is done here instead of the constructor, since User can change // the roles and handlerchain after a stub/proxy is created. setUpProcessorInternal(); MessageUpdatableContext context = getContext(request); boolean isOneWay = checkOneWay(request); try { if (!isHandlerChainEmpty()) { // Call handlers on Request boolean handlerResult = callHandlersOnRequest(context, isOneWay); //Update Packet with user modifications context.updatePacket(); // two-way case where no message is sent if (!isOneWay && !handlerResult) { return doReturnWith(request); } } requestProcessingSucessful = true; // Call next Tube return doInvoke(super.next, request); } catch (RuntimeException re) { if(isOneWay) { //Eat the exception, its already logged and close the transportBackChannel if(request.transportBackChannel != null ) { request.transportBackChannel.close(); } request.setMessage(null); return doReturnWith(request); } else throw re; } finally { if(!requestProcessingSucessful) { initiateClosing(context.getMessageContext()); } } }
Example 16
Source File: XMLCodec.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
public void decode(InputStream in, String contentType, Packet packet) throws IOException { Message message = XMLMessage.create(contentType, in, features); packet.setMessage(message); }
Example 17
Source File: XMLCodec.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
public void decode(InputStream in, String contentType, Packet packet) throws IOException { Message message = XMLMessage.create(contentType, in, features); packet.setMessage(message); }
Example 18
Source File: HandlerTube.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
@Override public NextAction processRequest(Packet request) { setupExchange(); // This check is done to cover handler returning false in Oneway request if (isHandleFalse()) { // Cousin HandlerTube returned false during Oneway Request processing. // Don't call handlers and dispatch the message. remedyActionTaken = true; return doInvoke(super.next, request); } // This is done here instead of the constructor, since User can change // the roles and handlerchain after a stub/proxy is created. setUpProcessorInternal(); MessageUpdatableContext context = getContext(request); boolean isOneWay = checkOneWay(request); try { if (!isHandlerChainEmpty()) { // Call handlers on Request boolean handlerResult = callHandlersOnRequest(context, isOneWay); //Update Packet with user modifications context.updatePacket(); // two-way case where no message is sent if (!isOneWay && !handlerResult) { return doReturnWith(request); } } requestProcessingSucessful = true; // Call next Tube return doInvoke(super.next, request); } catch (RuntimeException re) { if(isOneWay) { //Eat the exception, its already logged and close the transportBackChannel if(request.transportBackChannel != null ) { request.transportBackChannel.close(); } request.setMessage(null); return doReturnWith(request); } else throw re; } finally { if(!requestProcessingSucessful) { initiateClosing(context.getMessageContext()); } } }
Example 19
Source File: HandlerTube.java From hottub with GNU General Public License v2.0 | 4 votes |
@Override public NextAction processRequest(Packet request) { setupExchange(); // This check is done to cover handler returning false in Oneway request if (isHandleFalse()) { // Cousin HandlerTube returned false during Oneway Request processing. // Don't call handlers and dispatch the message. remedyActionTaken = true; return doInvoke(super.next, request); } // This is done here instead of the constructor, since User can change // the roles and handlerchain after a stub/proxy is created. setUpProcessorInternal(); MessageUpdatableContext context = getContext(request); boolean isOneWay = checkOneWay(request); try { if (!isHandlerChainEmpty()) { // Call handlers on Request boolean handlerResult = callHandlersOnRequest(context, isOneWay); //Update Packet with user modifications context.updatePacket(); // two-way case where no message is sent if (!isOneWay && !handlerResult) { return doReturnWith(request); } } requestProcessingSucessful = true; // Call next Tube return doInvoke(super.next, request); } catch (RuntimeException re) { if(isOneWay) { //Eat the exception, its already logged and close the transportBackChannel if(request.transportBackChannel != null ) { request.transportBackChannel.close(); } request.setMessage(null); return doReturnWith(request); } else throw re; } finally { if(!requestProcessingSucessful) { initiateClosing(context.getMessageContext()); } } }
Example 20
Source File: FastInfosetStreamSOAPCodec.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
public void decode(InputStream in, String contentType, Packet response) throws IOException { response.setMessage( _soapCodec.decode(getXMLStreamReader(in))); }