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

Sat, 07 Nov 2020 10:30:02 +0800

author
aoqi
date
Sat, 07 Nov 2020 10:30:02 +0800
changeset 1921
7166269ef0f1
parent 637
9c07ef4934dd
permissions
-rw-r--r--

Added tag mips-jdk8u275-b01 for changeset fdbe50121f48

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

mercurial