src/share/jaxws_classes/javax/xml/soap/SAAJResult.java

Fri, 04 Oct 2013 16:21:34 +0100

author
mkos
date
Fri, 04 Oct 2013 16:21:34 +0100
changeset 408
b0610cd08440
parent 368
0989ad8c0860
child 637
9c07ef4934dd
permissions
-rw-r--r--

8025054: Update JAX-WS RI integration to 2.2.9-b130926.1035
Reviewed-by: chegar

ohair@286 1 /*
alanb@368 2 * Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
ohair@286 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
ohair@286 4 *
ohair@286 5 * This code is free software; you can redistribute it and/or modify it
ohair@286 6 * under the terms of the GNU General Public License version 2 only, as
ohair@286 7 * published by the Free Software Foundation. Oracle designates this
ohair@286 8 * particular file as subject to the "Classpath" exception as provided
ohair@286 9 * by Oracle in the LICENSE file that accompanied this code.
ohair@286 10 *
ohair@286 11 * This code is distributed in the hope that it will be useful, but WITHOUT
ohair@286 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
ohair@286 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
ohair@286 14 * version 2 for more details (a copy is included in the LICENSE file that
ohair@286 15 * accompanied this code).
ohair@286 16 *
ohair@286 17 * You should have received a copy of the GNU General Public License version
ohair@286 18 * 2 along with this work; if not, write to the Free Software Foundation,
ohair@286 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
ohair@286 20 *
ohair@286 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
ohair@286 22 * or visit www.oracle.com if you need additional information or have any
ohair@286 23 * questions.
ohair@286 24 */
ohair@286 25
ohair@286 26 package javax.xml.soap;
ohair@286 27
ohair@286 28 import javax.xml.transform.dom.DOMResult;
ohair@286 29
ohair@286 30 /**
ohair@286 31 * Acts as a holder for the results of a JAXP transformation or a JAXB
ohair@286 32 * marshalling, in the form of a SAAJ tree. These results should be accessed
ohair@286 33 * by using the {@link #getResult()} method. The {@link DOMResult#getNode()}
ohair@286 34 * method should be avoided in almost all cases.
ohair@286 35 *
ohair@286 36 * @author XWS-Security Development Team
ohair@286 37 *
ohair@286 38 * @since SAAJ 1.3
ohair@286 39 */
ohair@286 40 public class SAAJResult extends DOMResult {
ohair@286 41
ohair@286 42 /**
ohair@286 43 * Creates a <code>SAAJResult</code> that will present results in the form
ohair@286 44 * of a SAAJ tree that supports the default (SOAP 1.1) protocol.
ohair@286 45 * <p>
ohair@286 46 * This kind of <code>SAAJResult</code> is meant for use in situations where the
ohair@286 47 * results will be used as a parameter to a method that takes a parameter
ohair@286 48 * whose type, such as <code>SOAPElement</code>, is drawn from the SAAJ
ohair@286 49 * API. When used in a transformation, the results are populated into the
ohair@286 50 * <code>SOAPPart</code> of a <code>SOAPMessage</code> that is created internally.
ohair@286 51 * The <code>SOAPPart</code> returned by {@link DOMResult#getNode()}
ohair@286 52 * is not guaranteed to be well-formed.
ohair@286 53 *
ohair@286 54 * @throws SOAPException if there is a problem creating a <code>SOAPMessage</code>
ohair@286 55 *
ohair@286 56 * @since SAAJ 1.3
ohair@286 57 */
ohair@286 58 public SAAJResult() throws SOAPException {
ohair@286 59 this(MessageFactory.newInstance().createMessage());
ohair@286 60 }
ohair@286 61
ohair@286 62 /**
ohair@286 63 * Creates a <code>SAAJResult</code> that will present results in the form
ohair@286 64 * of a SAAJ tree that supports the specified protocol. The
ohair@286 65 * <code>DYNAMIC_SOAP_PROTOCOL</code> is ambiguous in this context and will
ohair@286 66 * cause this constructor to throw an <code>UnsupportedOperationException</code>.
ohair@286 67 * <p>
ohair@286 68 * This kind of <code>SAAJResult</code> is meant for use in situations where the
ohair@286 69 * results will be used as a parameter to a method that takes a parameter
ohair@286 70 * whose type, such as <code>SOAPElement</code>, is drawn from the SAAJ
ohair@286 71 * API. When used in a transformation the results are populated into the
ohair@286 72 * <code>SOAPPart</code> of a <code>SOAPMessage</code> that is created
ohair@286 73 * internally. The <code>SOAPPart</code> returned by {@link DOMResult#getNode()}
ohair@286 74 * is not guaranteed to be well-formed.
ohair@286 75 *
ohair@286 76 * @param protocol - the name of the SOAP protocol that the resulting SAAJ
ohair@286 77 * tree should support
ohair@286 78 *
ohair@286 79 * @throws SOAPException if a <code>SOAPMessage</code> supporting the
ohair@286 80 * specified protocol cannot be created
ohair@286 81 *
ohair@286 82 * @since SAAJ 1.3
ohair@286 83 */
ohair@286 84 public SAAJResult(String protocol) throws SOAPException {
ohair@286 85 this(MessageFactory.newInstance(protocol).createMessage());
ohair@286 86 }
ohair@286 87
ohair@286 88 /**
ohair@286 89 * Creates a <code>SAAJResult</code> that will write the results into the
ohair@286 90 * <code>SOAPPart</code> of the supplied <code>SOAPMessage</code>.
ohair@286 91 * In the normal case these results will be written using DOM APIs and,
ohair@286 92 * as a result, the finished <code>SOAPPart</code> will not be guaranteed
ohair@286 93 * to be well-formed unless the data used to create it is also well formed.
ohair@286 94 * When used in a transformation the validity of the <code>SOAPMessage</code>
ohair@286 95 * after the transformation can be guaranteed only by means outside SAAJ
ohair@286 96 * specification.
ohair@286 97 *
ohair@286 98 * @param message - the message whose <code>SOAPPart</code> will be
ohair@286 99 * populated as a result of some transformation or
ohair@286 100 * marshalling operation
ohair@286 101 *
ohair@286 102 * @since SAAJ 1.3
ohair@286 103 */
ohair@286 104 public SAAJResult(SOAPMessage message) {
ohair@286 105 super(message.getSOAPPart());
ohair@286 106 }
ohair@286 107
ohair@286 108 /**
ohair@286 109 * Creates a <code>SAAJResult</code> that will write the results as a
ohair@286 110 * child node of the <code>SOAPElement</code> specified. In the normal
ohair@286 111 * case these results will be written using DOM APIs and as a result may
ohair@286 112 * invalidate the structure of the SAAJ tree. This kind of
ohair@286 113 * <code>SAAJResult</code> should only be used when the validity of the
ohair@286 114 * incoming data can be guaranteed by means outside of the SAAJ
ohair@286 115 * specification.
ohair@286 116 *
ohair@286 117 * @param rootNode - the root to which the results will be appended
ohair@286 118 *
ohair@286 119 * @since SAAJ 1.3
ohair@286 120 */
ohair@286 121 public SAAJResult(SOAPElement rootNode) {
ohair@286 122 super(rootNode);
ohair@286 123 }
ohair@286 124
ohair@286 125
ohair@286 126 /**
ohair@286 127 * @return the resulting Tree that was created under the specified root Node.
ohair@286 128 * @since SAAJ 1.3
ohair@286 129 */
ohair@286 130 public javax.xml.soap.Node getResult() {
ohair@286 131 return (javax.xml.soap.Node)super.getNode().getFirstChild();
ohair@286 132 }
ohair@286 133 }

mercurial