8176508: Update JAX-WS RI integration to latest version
Reviewed-by: lancea, mchung, alanb, iris
This commit is contained in:
parent
b55b119b30
commit
5e00da6b12
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -118,6 +118,9 @@ public class CommandInfo {
|
||||
* passed to the command.
|
||||
* @param loader The ClassLoader to be used to instantiate the bean.
|
||||
* @return The bean
|
||||
* @exception IOException for failures reading data
|
||||
* @exception ClassNotFoundException if command object class can't
|
||||
* be found
|
||||
* @see java.beans.Beans#instantiate
|
||||
* @see javax.activation.CommandObject
|
||||
*/
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -48,6 +48,7 @@ public interface CommandObject {
|
||||
*
|
||||
* @param verb The Command Verb this object refers to.
|
||||
* @param dh The DataHandler.
|
||||
* @exception IOException for failures accessing data
|
||||
*/
|
||||
public void setCommandContext(String verb, DataHandler dh)
|
||||
throws IOException;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -326,6 +326,7 @@ public class DataHandler implements Transferable {
|
||||
* Otherwise, {@code null} is returned.
|
||||
*
|
||||
* @return the OutputStream
|
||||
* @exception IOException for failures creating the OutputStream
|
||||
*
|
||||
* @see javax.activation.DataSource#getOutputStream
|
||||
* @see javax.activation.URLDataSource
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -49,6 +49,7 @@ public interface DataSource {
|
||||
* positioned at the beginning of the data.
|
||||
*
|
||||
* @return an InputStream
|
||||
* @exception IOException for failures creating the InputStream
|
||||
*/
|
||||
public InputStream getInputStream() throws IOException;
|
||||
|
||||
@ -60,6 +61,7 @@ public interface DataSource {
|
||||
* be positioned at the location the data is to be written.
|
||||
*
|
||||
* @return an OutputStream
|
||||
* @exception IOException for failures creating the OutputStream
|
||||
*/
|
||||
public OutputStream getOutputStream() throws IOException;
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -29,6 +29,8 @@ package javax.activation;
|
||||
import java.util.*;
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedAction;
|
||||
import com.sun.activation.registries.MailcapFile;
|
||||
import com.sun.activation.registries.LogSupport;
|
||||
|
||||
@ -48,12 +50,19 @@ import com.sun.activation.registries.LogSupport;
|
||||
* <ol>
|
||||
* <li> Programatically added entries to the MailcapCommandMap instance.
|
||||
* <li> The file {@code .mailcap} in the user's home directory.
|
||||
* <li> The file {@literal <}<i>java.home</i>{@literal >}{@code /lib/mailcap}.
|
||||
* <li> The file {@code mailcap} in the Java runtime.
|
||||
* <li> The file or resources named {@code META-INF/mailcap}.
|
||||
* <li> The file or resource named {@code META-INF/mailcap.default}
|
||||
* (usually found only in the {@code activation.jar} file).
|
||||
* </ol>
|
||||
* <p>
|
||||
* (The current implementation looks for the {@code mailcap} file
|
||||
* in the Java runtime in the directory <i>java.home</i>{@code /conf}
|
||||
* if it exists, and otherwise in the directory
|
||||
* <i>java.home</i>{@code /lib}, where <i>java.home</i> is the value
|
||||
* of the "java.home" System property. Note that the "conf" directory was
|
||||
* introduced in JDK 9.)
|
||||
* <p>
|
||||
* <b>Mailcap file format:</b><p>
|
||||
*
|
||||
* Mailcap files must conform to the mailcap
|
||||
@ -120,6 +129,29 @@ public class MailcapCommandMap extends CommandMap {
|
||||
private MailcapFile[] DB;
|
||||
private static final int PROG = 0; // programmatically added entries
|
||||
|
||||
private static final String confDir;
|
||||
|
||||
static {
|
||||
String dir = null;
|
||||
try {
|
||||
dir = (String)AccessController.doPrivileged(
|
||||
new PrivilegedAction() {
|
||||
public Object run() {
|
||||
String home = System.getProperty("java.home");
|
||||
String newdir = home + File.separator + "conf";
|
||||
File conf = new File(newdir);
|
||||
if (conf.exists())
|
||||
return newdir + File.separator;
|
||||
else
|
||||
return home + File.separator + "lib" + File.separator;
|
||||
}
|
||||
});
|
||||
} catch (Exception ex) {
|
||||
// ignore any exceptions
|
||||
}
|
||||
confDir = dir;
|
||||
}
|
||||
|
||||
/**
|
||||
* The default Constructor.
|
||||
*/
|
||||
@ -144,11 +176,11 @@ public class MailcapCommandMap extends CommandMap {
|
||||
LogSupport.log("MailcapCommandMap: load SYS");
|
||||
try {
|
||||
// check system's home
|
||||
String system_mailcap = System.getProperty("java.home") +
|
||||
File.separator + "lib" + File.separator + "mailcap";
|
||||
mf = loadFile(system_mailcap);
|
||||
if (mf != null)
|
||||
dbv.add(mf);
|
||||
if (confDir != null) {
|
||||
mf = loadFile(confDir + "mailcap");
|
||||
if (mf != null)
|
||||
dbv.add(mf);
|
||||
}
|
||||
} catch (SecurityException ex) {}
|
||||
|
||||
LogSupport.log("MailcapCommandMap: load JAR");
|
||||
@ -633,6 +665,7 @@ public class MailcapCommandMap extends CommandMap {
|
||||
* entries that specify a view command for the specified
|
||||
* MIME type are returned.
|
||||
*
|
||||
* @param mimeType the MIME type
|
||||
* @return array of native command entries
|
||||
* @since 1.6, JAF 1.1
|
||||
*/
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -58,6 +58,7 @@ public class MimeType implements Externalizable {
|
||||
* Constructor that builds a MimeType from a String.
|
||||
*
|
||||
* @param rawdata the MIME type string
|
||||
* @exception MimeTypeParseException if the MIME type can't be parsed
|
||||
*/
|
||||
public MimeType(String rawdata) throws MimeTypeParseException {
|
||||
parse(rawdata);
|
||||
@ -258,6 +259,7 @@ public class MimeType implements Externalizable {
|
||||
*
|
||||
* @param rawdata the MIME type string to compare with
|
||||
* @return true if they match
|
||||
* @exception MimeTypeParseException if the MIME type can't be parsed
|
||||
*/
|
||||
public boolean match(String rawdata) throws MimeTypeParseException {
|
||||
return match(new MimeType(rawdata));
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -58,6 +58,7 @@ public class MimeTypeParameterList {
|
||||
* Constructs a new MimeTypeParameterList with the passed in data.
|
||||
*
|
||||
* @param parameterList an RFC 2045, 2046 compliant parameter list.
|
||||
* @exception MimeTypeParseException if the MIME type can't be parsed
|
||||
*/
|
||||
public MimeTypeParameterList(String parameterList)
|
||||
throws MimeTypeParseException {
|
||||
@ -71,6 +72,7 @@ public class MimeTypeParameterList {
|
||||
* A routine for parsing the parameter list out of a String.
|
||||
*
|
||||
* @param parameterList an RFC 2045, 2046 compliant parameter list.
|
||||
* @exception MimeTypeParseException if the MIME type can't be parsed
|
||||
*/
|
||||
protected void parse(String parameterList) throws MimeTypeParseException {
|
||||
if (parameterList == null)
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -28,6 +28,8 @@ package javax.activation;
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
import java.util.*;
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedAction;
|
||||
import com.sun.activation.registries.MimeTypeFile;
|
||||
import com.sun.activation.registries.LogSupport;
|
||||
|
||||
@ -43,12 +45,19 @@ import com.sun.activation.registries.LogSupport;
|
||||
* <ol>
|
||||
* <li> Programmatically added entries to the MimetypesFileTypeMap instance.
|
||||
* <li> The file {@code .mime.types} in the user's home directory.
|
||||
* <li> The file {@literal <}<i>java.home</i>{@literal >}{@code /lib/mime.types}.
|
||||
* <li> The file {@code mime.types} in the Java runtime.
|
||||
* <li> The file or resources named {@code META-INF/mime.types}.
|
||||
* <li> The file or resource named {@code META-INF/mimetypes.default}
|
||||
* (usually found only in the {@code activation.jar} file).
|
||||
* </ol>
|
||||
* <p>
|
||||
* (The current implementation looks for the {@code mime.types} file
|
||||
* in the Java runtime in the directory <i>java.home</i>{@code /conf}
|
||||
* if it exists, and otherwise in the directory
|
||||
* <i>java.home</i>{@code /lib}, where <i>java.home</i> is the value
|
||||
* of the "java.home" System property. Note that the "conf" directory was
|
||||
* introduced in JDK 9.)
|
||||
* <p>
|
||||
* <b>MIME types file format:</b>
|
||||
*
|
||||
* <pre>{@code
|
||||
@ -72,7 +81,30 @@ public class MimetypesFileTypeMap extends FileTypeMap {
|
||||
private MimeTypeFile[] DB;
|
||||
private static final int PROG = 0; // programmatically added entries
|
||||
|
||||
private static String defaultType = "application/octet-stream";
|
||||
private static final String defaultType = "application/octet-stream";
|
||||
|
||||
private static final String confDir;
|
||||
|
||||
static {
|
||||
String dir = null;
|
||||
try {
|
||||
dir = (String)AccessController.doPrivileged(
|
||||
new PrivilegedAction() {
|
||||
public Object run() {
|
||||
String home = System.getProperty("java.home");
|
||||
String newdir = home + File.separator + "conf";
|
||||
File conf = new File(newdir);
|
||||
if (conf.exists())
|
||||
return newdir + File.separator;
|
||||
else
|
||||
return home + File.separator + "lib" + File.separator;
|
||||
}
|
||||
});
|
||||
} catch (Exception ex) {
|
||||
// ignore any exceptions
|
||||
}
|
||||
confDir = dir;
|
||||
}
|
||||
|
||||
/**
|
||||
* The default constructor.
|
||||
@ -97,11 +129,11 @@ public class MimetypesFileTypeMap extends FileTypeMap {
|
||||
LogSupport.log("MimetypesFileTypeMap: load SYS");
|
||||
try {
|
||||
// check system's home
|
||||
String system_mimetypes = System.getProperty("java.home") +
|
||||
File.separator + "lib" + File.separator + "mime.types";
|
||||
mf = loadFile(system_mimetypes);
|
||||
if (mf != null)
|
||||
dbv.addElement(mf);
|
||||
if (confDir != null) {
|
||||
mf = loadFile(confDir + "mime.types");
|
||||
if (mf != null)
|
||||
dbv.addElement(mf);
|
||||
}
|
||||
} catch (SecurityException ex) {}
|
||||
|
||||
LogSupport.log("MimetypesFileTypeMap: load JAR");
|
||||
@ -239,6 +271,7 @@ public class MimetypesFileTypeMap extends FileTypeMap {
|
||||
* added from the named file.
|
||||
*
|
||||
* @param mimeTypeFileName the file name
|
||||
* @exception IOException for errors reading the file
|
||||
*/
|
||||
public MimetypesFileTypeMap(String mimeTypeFileName) throws IOException {
|
||||
this();
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -48,10 +48,10 @@ public class MinimumEscapeHandler implements CharacterEscapeHandler {
|
||||
int limit = start+length;
|
||||
for (int i = start; i < limit; i++) {
|
||||
char c = ch[i];
|
||||
if(c == '&' || c == '<' || c == '>' || c == '\r' || (c == '\"' && isAttVal) ) {
|
||||
if(i!=start)
|
||||
out.write(ch,start,i-start);
|
||||
start = i+1;
|
||||
if (c == '&' || c == '<' || c == '>' || c == '\r' || (c == '\n' && isAttVal) || (c == '\"' && isAttVal)) {
|
||||
if (i != start)
|
||||
out.write(ch, start, i - start);
|
||||
start = i + 1;
|
||||
switch (ch[i]) {
|
||||
case '&':
|
||||
out.write("&");
|
||||
@ -65,6 +65,14 @@ public class MinimumEscapeHandler implements CharacterEscapeHandler {
|
||||
case '\"':
|
||||
out.write(""");
|
||||
break;
|
||||
case '\n':
|
||||
case '\r':
|
||||
out.write("&#");
|
||||
out.write(Integer.toString(c));
|
||||
out.write(';');
|
||||
break;
|
||||
default:
|
||||
throw new IllegalArgumentException("Cannot escape: '" + c + "'");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,45 @@
|
||||
/*
|
||||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.xml.internal.bind.marshaller;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
|
||||
/**
|
||||
* Performs no character escaping.
|
||||
*
|
||||
* @author
|
||||
* Roman Grigoriadi (roman.grigoriadi@oracle.com)
|
||||
*/
|
||||
public class NoEscapeHandler implements CharacterEscapeHandler {
|
||||
|
||||
public static final NoEscapeHandler theInstance = new NoEscapeHandler();
|
||||
|
||||
@Override
|
||||
public void escape(char[] ch, int start, int length, boolean isAttVal, Writer out) throws IOException {
|
||||
out.write(ch, start, length);
|
||||
}
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -76,7 +76,7 @@ final class BridgeImpl<T> extends InternalBridge<T> {
|
||||
|
||||
public void marshal(Marshaller _m, T t, XMLStreamWriter output) throws JAXBException {
|
||||
MarshallerImpl m = (MarshallerImpl)_m;
|
||||
m.write(tagName,bi,t,XMLStreamWriterOutput.create(output,context),new StAXPostInitAction(output,m.serializer));
|
||||
m.write(tagName,bi,t,XMLStreamWriterOutput.create(output,context, m.getEscapeHandler()),new StAXPostInitAction(output,m.serializer));
|
||||
}
|
||||
|
||||
public void marshal(Marshaller _m, T t, OutputStream output, NamespaceContext nsContext) throws JAXBException {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -165,7 +165,7 @@ public /*to make unit tests happy*/ final class MarshallerImpl extends AbstractM
|
||||
|
||||
@Override
|
||||
public void marshal(Object obj, XMLStreamWriter writer) throws JAXBException {
|
||||
write(obj, XMLStreamWriterOutput.create(writer,context), new StAXPostInitAction(writer,serializer));
|
||||
write(obj, XMLStreamWriterOutput.create(writer,context, escapeHandler), new StAXPostInitAction(writer,serializer));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -371,6 +371,15 @@ public /*to make unit tests happy*/ final class MarshallerImpl extends AbstractM
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns escape handler provided with JAXB context parameters.
|
||||
*
|
||||
* @return escape handler
|
||||
*/
|
||||
CharacterEscapeHandler getEscapeHandler() {
|
||||
return escapeHandler;
|
||||
}
|
||||
|
||||
//
|
||||
//
|
||||
// create XMLWriter by specifing various type of output.
|
||||
@ -436,13 +445,14 @@ public /*to make unit tests happy*/ final class MarshallerImpl extends AbstractM
|
||||
if(encoding.equals("UTF-8")) {
|
||||
Encoded[] table = context.getUTF8NameTable();
|
||||
final UTF8XmlOutput out;
|
||||
CharacterEscapeHandler ceh = createEscapeHandler(encoding);
|
||||
if(isFormattedOutput())
|
||||
out = new IndentingUTF8XmlOutput(os, indent, table, escapeHandler);
|
||||
out = new IndentingUTF8XmlOutput(os, indent, table, ceh);
|
||||
else {
|
||||
if(c14nSupport)
|
||||
out = new C14nXmlOutput(os, table, context.c14nSupport, escapeHandler);
|
||||
out = new C14nXmlOutput(os, table, context.c14nSupport, ceh);
|
||||
else
|
||||
out = new UTF8XmlOutput(os, table, escapeHandler);
|
||||
out = new UTF8XmlOutput(os, table, ceh);
|
||||
}
|
||||
if(header!=null)
|
||||
out.setHeader(header);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -25,21 +25,22 @@
|
||||
|
||||
package com.sun.xml.internal.bind.v2.runtime.output;
|
||||
|
||||
import com.sun.xml.internal.bind.marshaller.NoEscapeHandler;
|
||||
import com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl;
|
||||
import com.sun.xml.internal.bind.v2.runtime.Name;
|
||||
import com.sun.xml.internal.bind.v2.runtime.XMLSerializer;
|
||||
import javax.xml.stream.XMLStreamException;
|
||||
|
||||
import com.sun.xml.internal.bind.v2.runtime.unmarshaller.Base64Data;
|
||||
import com.sun.xml.internal.fastinfoset.EncodingConstants;
|
||||
import com.sun.xml.internal.fastinfoset.stax.StAXDocumentSerializer;
|
||||
import com.sun.xml.internal.org.jvnet.fastinfoset.VocabularyApplicationData;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
import javax.xml.bind.JAXBContext;
|
||||
import javax.xml.stream.XMLStreamException;
|
||||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
import java.util.WeakHashMap;
|
||||
import javax.xml.bind.JAXBContext;
|
||||
import com.sun.xml.internal.org.jvnet.fastinfoset.VocabularyApplicationData;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
/**
|
||||
* {@link XmlOutput} for {@link StAXDocumentSerializer}.
|
||||
@ -220,7 +221,7 @@ public final class FastInfosetStreamWriterOutput extends XMLStreamWriterOutput {
|
||||
|
||||
public FastInfosetStreamWriterOutput(StAXDocumentSerializer out,
|
||||
JAXBContextImpl context) {
|
||||
super(out);
|
||||
super(out, NoEscapeHandler.theInstance);
|
||||
|
||||
this.fiout = out;
|
||||
this.localNames = context.getUTF8NameTable();
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -27,6 +27,7 @@ package com.sun.xml.internal.bind.v2.runtime.output;
|
||||
|
||||
import javax.xml.stream.XMLStreamException;
|
||||
|
||||
import com.sun.xml.internal.bind.marshaller.NoEscapeHandler;
|
||||
import com.sun.xml.internal.bind.v2.runtime.unmarshaller.Base64Data;
|
||||
|
||||
import com.sun.xml.internal.org.jvnet.staxex.XMLStreamWriterEx;
|
||||
@ -40,7 +41,7 @@ public final class StAXExStreamWriterOutput extends XMLStreamWriterOutput {
|
||||
private final XMLStreamWriterEx out;
|
||||
|
||||
public StAXExStreamWriterOutput(XMLStreamWriterEx out) {
|
||||
super(out);
|
||||
super(out, NoEscapeHandler.theInstance);
|
||||
this.out = out;
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -26,15 +26,16 @@
|
||||
package com.sun.xml.internal.bind.v2.runtime.output;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
import java.lang.reflect.Constructor;
|
||||
|
||||
import javax.xml.stream.XMLStreamException;
|
||||
import javax.xml.stream.XMLStreamWriter;
|
||||
|
||||
import com.sun.xml.internal.bind.marshaller.CharacterEscapeHandler;
|
||||
import com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl;
|
||||
import com.sun.xml.internal.bind.v2.runtime.XMLSerializer;
|
||||
|
||||
import com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
/**
|
||||
@ -53,7 +54,7 @@ public class XMLStreamWriterOutput extends XmlOutputAbstractImpl {
|
||||
* Creates a new {@link XmlOutput} from a {@link XMLStreamWriter}.
|
||||
* This method recognizes an FI StAX writer.
|
||||
*/
|
||||
public static XmlOutput create(XMLStreamWriter out, JAXBContextImpl context) {
|
||||
public static XmlOutput create(XMLStreamWriter out, JAXBContextImpl context, CharacterEscapeHandler escapeHandler) {
|
||||
// try optimized path
|
||||
final Class writerClass = out.getClass();
|
||||
if (writerClass==FI_STAX_WRITER_CLASS) {
|
||||
@ -69,17 +70,26 @@ public class XMLStreamWriterOutput extends XmlOutputAbstractImpl {
|
||||
}
|
||||
}
|
||||
|
||||
CharacterEscapeHandler xmlStreamEscapeHandler = escapeHandler != null ?
|
||||
escapeHandler : NewLineEscapeHandler.theInstance;
|
||||
|
||||
// otherwise the normal writer.
|
||||
return new XMLStreamWriterOutput(out);
|
||||
return new XMLStreamWriterOutput(out, xmlStreamEscapeHandler);
|
||||
}
|
||||
|
||||
|
||||
private final XMLStreamWriter out;
|
||||
|
||||
private final CharacterEscapeHandler escapeHandler;
|
||||
|
||||
private final XmlStreamOutWriterAdapter writerWrapper;
|
||||
|
||||
protected final char[] buf = new char[256];
|
||||
|
||||
protected XMLStreamWriterOutput(XMLStreamWriter out) {
|
||||
protected XMLStreamWriterOutput(XMLStreamWriter out, CharacterEscapeHandler escapeHandler) {
|
||||
this.out = out;
|
||||
this.escapeHandler = escapeHandler;
|
||||
this.writerWrapper = new XmlStreamOutWriterAdapter(out);
|
||||
}
|
||||
|
||||
// not called if we are generating fragments
|
||||
@ -137,7 +147,7 @@ public class XMLStreamWriterOutput extends XmlOutputAbstractImpl {
|
||||
public void text(String value, boolean needsSeparatingWhitespace) throws IOException, SAXException, XMLStreamException {
|
||||
if(needsSeparatingWhitespace)
|
||||
out.writeCharacters(" ");
|
||||
out.writeCharacters(value);
|
||||
escapeHandler.escape(value.toCharArray(), 0, value.length(), false, writerWrapper);
|
||||
}
|
||||
|
||||
public void text(Pcdata value, boolean needsSeparatingWhitespace) throws IOException, SAXException, XMLStreamException {
|
||||
@ -207,4 +217,81 @@ public class XMLStreamWriterOutput extends XmlOutputAbstractImpl {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs character escaping only for new lines.
|
||||
*/
|
||||
private static class NewLineEscapeHandler implements CharacterEscapeHandler {
|
||||
|
||||
public static final NewLineEscapeHandler theInstance = new NewLineEscapeHandler();
|
||||
|
||||
@Override
|
||||
public void escape(char[] ch, int start, int length, boolean isAttVal, Writer out) throws IOException {
|
||||
int limit = start+length;
|
||||
int lastEscaped = start;
|
||||
for (int i = start; i < limit; i++) {
|
||||
char c = ch[i];
|
||||
if (c == '\r' || c == '\n') {
|
||||
if (i != lastEscaped) {
|
||||
out.write(ch, lastEscaped, i - lastEscaped);
|
||||
}
|
||||
lastEscaped = i + 1;
|
||||
if (out instanceof XmlStreamOutWriterAdapter) {
|
||||
try {
|
||||
((XmlStreamOutWriterAdapter)out).writeEntityRef("#x" + Integer.toHexString(c));
|
||||
} catch (XMLStreamException e) {
|
||||
throw new IOException("Error writing xml stream", e);
|
||||
}
|
||||
} else {
|
||||
out.write("&#x");
|
||||
out.write(Integer.toHexString(c));
|
||||
out.write(';');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (lastEscaped != limit) {
|
||||
out.write(ch, lastEscaped, length - lastEscaped);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static final class XmlStreamOutWriterAdapter extends Writer {
|
||||
|
||||
private final XMLStreamWriter writer;
|
||||
|
||||
private XmlStreamOutWriterAdapter(XMLStreamWriter writer) {
|
||||
this.writer = writer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(char[] cbuf, int off, int len) throws IOException {
|
||||
try {
|
||||
writer.writeCharacters(cbuf, off, len);
|
||||
} catch (XMLStreamException e) {
|
||||
throw new IOException("Error writing XML stream", e);
|
||||
}
|
||||
}
|
||||
|
||||
public void writeEntityRef(String entityReference) throws XMLStreamException {
|
||||
writer.writeEntityRef(entityReference);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void flush() throws IOException {
|
||||
try {
|
||||
writer.flush();
|
||||
} catch (XMLStreamException e) {
|
||||
throw new IOException("Error flushing XML stream", e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
try {
|
||||
writer.close();
|
||||
} catch (XMLStreamException e) {
|
||||
throw new IOException("Error closing XML stream", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -150,13 +150,14 @@ class ContextFinder {
|
||||
* Create an instance of a class using the specified ClassLoader
|
||||
*/
|
||||
static JAXBContext newInstance(String contextPath,
|
||||
Class[] contextPathClasses,
|
||||
String className,
|
||||
ClassLoader classLoader,
|
||||
Map properties) throws JAXBException {
|
||||
|
||||
try {
|
||||
Class spFactory = ServiceLoaderUtil.safeLoadClass(className, PLATFORM_DEFAULT_FACTORY_CLASS, classLoader);
|
||||
return newInstance(contextPath, spFactory, classLoader, properties);
|
||||
return newInstance(contextPath, contextPathClasses, spFactory, classLoader, properties);
|
||||
} catch (ClassNotFoundException x) {
|
||||
throw new JAXBException(Messages.format(Messages.DEFAULT_PROVIDER_NOT_FOUND), x);
|
||||
|
||||
@ -175,6 +176,7 @@ class ContextFinder {
|
||||
}
|
||||
|
||||
static JAXBContext newInstance(String contextPath,
|
||||
Class[] contextPathClasses,
|
||||
Class spFactory,
|
||||
ClassLoader classLoader,
|
||||
Map properties) throws JAXBException {
|
||||
@ -212,6 +214,9 @@ class ContextFinder {
|
||||
// the cast would fail, so generate an exception with a nice message
|
||||
throw handleClassCastException(context.getClass(), JAXBContext.class);
|
||||
}
|
||||
|
||||
ModuleUtil.delegateAddOpensToImplModule(contextPathClasses, spFactory);
|
||||
|
||||
return (JAXBContext) context;
|
||||
} catch (InvocationTargetException x) {
|
||||
// throw if it is exception not to be wrapped
|
||||
@ -277,6 +282,7 @@ class ContextFinder {
|
||||
// the cast would fail, so generate an exception with a nice message
|
||||
throw handleClassCastException(context.getClass(), JAXBContext.class);
|
||||
}
|
||||
ModuleUtil.delegateAddOpensToImplModule(classes, spFactory);
|
||||
return (JAXBContext) context;
|
||||
|
||||
} catch (NoSuchMethodException | IllegalAccessException e) {
|
||||
@ -295,50 +301,52 @@ class ContextFinder {
|
||||
ClassLoader classLoader,
|
||||
Map properties) throws JAXBException {
|
||||
|
||||
StringTokenizer packages = new StringTokenizer(contextPath, ":");
|
||||
if (!packages.hasMoreTokens()) {
|
||||
if (contextPath == null || contextPath.isEmpty()) {
|
||||
// no context is specified
|
||||
throw new JAXBException(Messages.format(Messages.NO_PACKAGE_IN_CONTEXTPATH));
|
||||
}
|
||||
|
||||
// search for jaxb.properties in the class loader of each class first
|
||||
logger.fine("Searching jaxb.properties");
|
||||
while (packages.hasMoreTokens()) {
|
||||
// com.acme.foo - > com/acme/foo/jaxb.properties
|
||||
String factoryClassName =
|
||||
classNameFromPackageProperties(
|
||||
classLoader,
|
||||
packages.nextToken(":").replace('.', '/'),
|
||||
factoryId,
|
||||
JAXB_CONTEXT_FACTORY_DEPRECATED);
|
||||
//ModuleUtil is mr-jar class, scans context path for jaxb classes on jdk9 and higher
|
||||
Class[] contextPathClasses = ModuleUtil.getClassesFromContextPath(contextPath, classLoader);
|
||||
|
||||
if (factoryClassName != null) {
|
||||
return newInstance(contextPath, factoryClassName, classLoader, properties);
|
||||
}
|
||||
//first try with classloader#getResource
|
||||
String factoryClassName = jaxbProperties(contextPath, classLoader, factoryId);
|
||||
if (factoryClassName == null && contextPathClasses != null) {
|
||||
//try with class#getResource
|
||||
factoryClassName = jaxbProperties(contextPathClasses, factoryId);
|
||||
}
|
||||
|
||||
if (factoryClassName != null) {
|
||||
return newInstance(contextPath, contextPathClasses, factoryClassName, classLoader, properties);
|
||||
}
|
||||
|
||||
|
||||
String factoryName = classNameFromSystemProperties();
|
||||
if (factoryName != null) return newInstance(contextPath, factoryName, classLoader, properties);
|
||||
if (factoryName != null) return newInstance(contextPath, contextPathClasses, factoryName, classLoader, properties);
|
||||
|
||||
JAXBContextFactory obj = ServiceLoaderUtil.firstByServiceLoader(
|
||||
JAXBContextFactory.class, logger, EXCEPTION_HANDLER);
|
||||
|
||||
if (obj != null) return obj.createContext(contextPath, classLoader, properties);
|
||||
if (obj != null) {
|
||||
JAXBContext context = obj.createContext(contextPath, classLoader, properties);
|
||||
ModuleUtil.delegateAddOpensToImplModule(contextPathClasses, obj.getClass());
|
||||
return context;
|
||||
}
|
||||
|
||||
// to ensure backwards compatibility
|
||||
factoryName = firstByServiceLoaderDeprecated(JAXBContext.class, classLoader);
|
||||
if (factoryName != null) return newInstance(contextPath, factoryName, classLoader, properties);
|
||||
if (factoryName != null) return newInstance(contextPath, contextPathClasses, factoryName, classLoader, properties);
|
||||
|
||||
Class ctxFactory = (Class) ServiceLoaderUtil.lookupUsingOSGiServiceLoader(
|
||||
"javax.xml.bind.JAXBContext", logger);
|
||||
|
||||
if (ctxFactory != null) {
|
||||
return newInstance(contextPath, ctxFactory, classLoader, properties);
|
||||
return newInstance(contextPath, contextPathClasses, ctxFactory, classLoader, properties);
|
||||
}
|
||||
|
||||
// else no provider found
|
||||
logger.fine("Trying to create the platform default provider");
|
||||
return newInstance(contextPath, PLATFORM_DEFAULT_FACTORY_CLASS, classLoader, properties);
|
||||
return newInstance(contextPath, contextPathClasses, PLATFORM_DEFAULT_FACTORY_CLASS, classLoader, properties);
|
||||
}
|
||||
|
||||
static JAXBContext find(Class<?>[] classes, Map<String, ?> properties) throws JAXBException {
|
||||
@ -356,13 +364,18 @@ class ContextFinder {
|
||||
// TODO: it's easier to look things up from the class
|
||||
// c.getResourceAsStream("jaxb.properties");
|
||||
|
||||
String factoryClassName =
|
||||
classNameFromPackageProperties(
|
||||
getClassClassLoader(c),
|
||||
c.getPackage().getName().replace('.', '/'),
|
||||
JAXBContext.JAXB_CONTEXT_FACTORY, JAXB_CONTEXT_FACTORY_DEPRECATED);
|
||||
URL jaxbPropertiesUrl = getResourceUrl(c, "jaxb.properties");
|
||||
|
||||
if (jaxbPropertiesUrl != null) {
|
||||
|
||||
String factoryClassName =
|
||||
classNameFromPackageProperties(
|
||||
jaxbPropertiesUrl,
|
||||
JAXBContext.JAXB_CONTEXT_FACTORY, JAXB_CONTEXT_FACTORY_DEPRECATED);
|
||||
|
||||
return newInstance(classes, properties, factoryClassName);
|
||||
}
|
||||
|
||||
if (factoryClassName != null) return newInstance(classes, properties, factoryClassName);
|
||||
}
|
||||
|
||||
String factoryClassName = classNameFromSystemProperties();
|
||||
@ -371,7 +384,11 @@ class ContextFinder {
|
||||
JAXBContextFactory factory =
|
||||
ServiceLoaderUtil.firstByServiceLoader(JAXBContextFactory.class, logger, EXCEPTION_HANDLER);
|
||||
|
||||
if (factory != null) return factory.createContext(classes, properties);
|
||||
if (factory != null) {
|
||||
JAXBContext context = factory.createContext(classes, properties);
|
||||
ModuleUtil.delegateAddOpensToImplModule(classes, factory.getClass());
|
||||
return context;
|
||||
}
|
||||
|
||||
// to ensure backwards compatibility
|
||||
String className = firstByServiceLoaderDeprecated(JAXBContext.class, getContextClassLoader());
|
||||
@ -395,22 +412,20 @@ class ContextFinder {
|
||||
* first factoryId should be the preferred one,
|
||||
* more of those can be provided to support backwards compatibility
|
||||
*/
|
||||
private static String classNameFromPackageProperties(ClassLoader classLoader,
|
||||
String packageName,
|
||||
private static String classNameFromPackageProperties(URL packagePropertiesUrl,
|
||||
String ... factoryIds) throws JAXBException {
|
||||
|
||||
String resourceName = packageName + "/jaxb.properties";
|
||||
logger.log(Level.FINE, "Trying to locate {0}", resourceName);
|
||||
Properties props = loadJAXBProperties(classLoader, resourceName);
|
||||
if (props != null) {
|
||||
for(String factoryId : factoryIds) {
|
||||
if (props.containsKey(factoryId)) {
|
||||
return props.getProperty(factoryId);
|
||||
}
|
||||
logger.log(Level.FINE, "Trying to locate {0}", packagePropertiesUrl.toString());
|
||||
Properties props = loadJAXBProperties(packagePropertiesUrl);
|
||||
for(String factoryId : factoryIds) {
|
||||
if (props.containsKey(factoryId)) {
|
||||
return props.getProperty(factoryId);
|
||||
}
|
||||
throw new JAXBException(Messages.format(Messages.MISSING_PROPERTY, packageName, factoryIds[0]));
|
||||
}
|
||||
return null;
|
||||
//Factory key not found
|
||||
String propertiesUrl = packagePropertiesUrl.toExternalForm();
|
||||
String packageName = propertiesUrl.substring(0, propertiesUrl.indexOf("/jaxb.properties"));
|
||||
throw new JAXBException(Messages.format(Messages.MISSING_PROPERTY, packageName, factoryIds[0]));
|
||||
}
|
||||
|
||||
private static String classNameFromSystemProperties() throws JAXBException {
|
||||
@ -452,30 +467,40 @@ class ContextFinder {
|
||||
return value;
|
||||
}
|
||||
|
||||
private static Properties loadJAXBProperties(ClassLoader classLoader,
|
||||
String propFileName) throws JAXBException {
|
||||
private static Properties loadJAXBProperties(URL url) throws JAXBException {
|
||||
|
||||
Properties props = null;
|
||||
try {
|
||||
URL url;
|
||||
if (classLoader == null)
|
||||
url = ClassLoader.getSystemResource(propFileName);
|
||||
else
|
||||
url = classLoader.getResource(propFileName);
|
||||
|
||||
if (url != null) {
|
||||
logger.log(Level.FINE, "loading props from {0}", url);
|
||||
props = new Properties();
|
||||
InputStream is = url.openStream();
|
||||
props.load(is);
|
||||
is.close();
|
||||
}
|
||||
Properties props;
|
||||
logger.log(Level.FINE, "loading props from {0}", url);
|
||||
props = new Properties();
|
||||
InputStream is = url.openStream();
|
||||
props.load(is);
|
||||
is.close();
|
||||
return props;
|
||||
} catch (IOException ioe) {
|
||||
logger.log(Level.FINE, "Unable to load " + propFileName, ioe);
|
||||
logger.log(Level.FINE, "Unable to load " + url.toString(), ioe);
|
||||
throw new JAXBException(ioe.toString(), ioe);
|
||||
}
|
||||
}
|
||||
|
||||
return props;
|
||||
/**
|
||||
* If run on JPMS package containing resource must be open unconditionally.
|
||||
*
|
||||
* @param classLoader classloader to load resource with
|
||||
* @param resourceName qualified name of the resource
|
||||
* @return resource url if found
|
||||
*/
|
||||
private static URL getResourceUrl(ClassLoader classLoader, String resourceName) {
|
||||
URL url;
|
||||
if (classLoader == null)
|
||||
url = ClassLoader.getSystemResource(resourceName);
|
||||
else
|
||||
url = classLoader.getResource(resourceName);
|
||||
return url;
|
||||
}
|
||||
|
||||
private static URL getResourceUrl(Class<?> clazz, String resourceName) {
|
||||
return clazz.getResource(resourceName);
|
||||
}
|
||||
|
||||
|
||||
@ -606,4 +631,28 @@ class ContextFinder {
|
||||
}
|
||||
}
|
||||
|
||||
private static String jaxbProperties(String contextPath, ClassLoader classLoader, String factoryId) throws JAXBException {
|
||||
String[] packages = contextPath.split(":");
|
||||
|
||||
for (String pkg : packages) {
|
||||
String pkgUrl = pkg.replace('.', '/');
|
||||
URL jaxbPropertiesUrl = getResourceUrl(classLoader, pkgUrl + "/jaxb.properties");
|
||||
if (jaxbPropertiesUrl != null) {
|
||||
return classNameFromPackageProperties(jaxbPropertiesUrl,
|
||||
factoryId, JAXB_CONTEXT_FACTORY_DEPRECATED);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static String jaxbProperties(Class[] classesFromContextPath, String factoryId) throws JAXBException {
|
||||
for (Class c : classesFromContextPath) {
|
||||
URL jaxbPropertiesUrl = getResourceUrl(c, "jaxb.properties");
|
||||
if (jaxbPropertiesUrl != null) {
|
||||
return classNameFromPackageProperties(jaxbPropertiesUrl, factoryId, JAXB_CONTEXT_FACTORY_DEPRECATED);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -27,11 +27,11 @@ package javax.xml.bind;
|
||||
|
||||
import org.w3c.dom.Node;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
/**
|
||||
* The {@code JAXBContext} class provides the client's entry point to the
|
||||
@ -227,6 +227,9 @@ import java.io.InputStream;
|
||||
* This phase of the look up allows some packages to force the use of a certain JAXB implementation.
|
||||
* (For example, perhaps the schema compiler has generated some vendor extension in the code.)
|
||||
*
|
||||
* <p>
|
||||
* This configuration method is deprecated.
|
||||
*
|
||||
* <li>
|
||||
* If the system property {@link #JAXB_CONTEXT_FACTORY} exists, then its value is assumed to be the provider
|
||||
* factory class. If no such property exists, properties {@code "javax.xml.bind.context.factory"} and
|
||||
@ -332,7 +335,14 @@ public abstract class JAXBContext {
|
||||
* the context class loader of the current thread.
|
||||
*
|
||||
* @throws JAXBException if an error was encountered while creating the
|
||||
* {@code JAXBContext}. See {@link JAXBContext#newInstance(String, ClassLoader, Map)} for details.
|
||||
* {@code JAXBContext} such as
|
||||
* <ol>
|
||||
* <li>failure to locate either ObjectFactory.class or jaxb.index in the packages</li>
|
||||
* <li>an ambiguity among global elements contained in the contextPath</li>
|
||||
* <li>failure to locate a value for the context factory provider property</li>
|
||||
* <li>mixing schema derived packages from different providers on the same contextPath</li>
|
||||
* <li>packages are not open to {@code java.xml.bind} module</li>
|
||||
* </ol>
|
||||
*/
|
||||
public static JAXBContext newInstance( String contextPath )
|
||||
throws JAXBException {
|
||||
@ -414,16 +424,26 @@ public abstract class JAXBContext {
|
||||
* <p>
|
||||
* The steps involved in discovering the JAXB implementation is discussed in the class javadoc.
|
||||
*
|
||||
* @param contextPath list of java package names that contain schema
|
||||
* derived class and/or java to schema (JAXB-annotated)
|
||||
* mapped classes
|
||||
* @param contextPath
|
||||
* List of java package names that contain schema
|
||||
* derived class and/or java to schema (JAXB-annotated)
|
||||
* mapped classes.
|
||||
* Packages in {@code contextPath} that are in named modules must be
|
||||
* {@linkplain java.lang.Module#isOpen open} to at least the {@code java.xml.bind} module.
|
||||
* @param classLoader
|
||||
* This class loader will be used to locate the implementation
|
||||
* classes.
|
||||
*
|
||||
* @return a new instance of a {@code JAXBContext}
|
||||
* @throws JAXBException if an error was encountered while creating the
|
||||
* {@code JAXBContext}. See {@link JAXBContext#newInstance(String, ClassLoader, Map)} for details.
|
||||
* {@code JAXBContext} such as
|
||||
* <ol>
|
||||
* <li>failure to locate either ObjectFactory.class or jaxb.index in the packages</li>
|
||||
* <li>an ambiguity among global elements contained in the contextPath</li>
|
||||
* <li>failure to locate a value for the context factory provider property</li>
|
||||
* <li>mixing schema derived packages from different providers on the same contextPath</li>
|
||||
* <li>packages are not open to {@code java.xml.bind} module</li>
|
||||
* </ol>
|
||||
*/
|
||||
public static JAXBContext newInstance( String contextPath, ClassLoader classLoader ) throws JAXBException {
|
||||
|
||||
@ -442,7 +462,12 @@ public abstract class JAXBContext {
|
||||
* The interpretation of properties is up to implementations. Implementations must
|
||||
* throw {@code JAXBException} if it finds properties that it doesn't understand.
|
||||
*
|
||||
* @param contextPath list of java package names that contain schema derived classes
|
||||
* @param contextPath
|
||||
* List of java package names that contain schema
|
||||
* derived class and/or java to schema (JAXB-annotated)
|
||||
* mapped classes.
|
||||
* Packages in {@code contextPath} that are in named modules must be
|
||||
* {@linkplain java.lang.Module#isOpen open} to at least the {@code java.xml.bind} module.
|
||||
* @param classLoader
|
||||
* This class loader will be used to locate the implementation classes.
|
||||
* @param properties
|
||||
@ -457,6 +482,7 @@ public abstract class JAXBContext {
|
||||
* <li>an ambiguity among global elements contained in the contextPath</li>
|
||||
* <li>failure to locate a value for the context factory provider property</li>
|
||||
* <li>mixing schema derived packages from different providers on the same contextPath</li>
|
||||
* <li>packages are not open to {@code java.xml.bind} module</li>
|
||||
* </ol>
|
||||
* @since 1.6, JAXB 2.0
|
||||
*/
|
||||
@ -588,15 +614,27 @@ public abstract class JAXBContext {
|
||||
* The steps involved in discovering the JAXB implementation is discussed in the class javadoc.
|
||||
*
|
||||
* @param classesToBeBound
|
||||
* list of java classes to be recognized by the new {@link JAXBContext}.
|
||||
* List of java classes to be recognized by the new {@link JAXBContext}.
|
||||
* Classes in {@code classesToBeBound} that are in named modules must be in a package
|
||||
* that is {@linkplain java.lang.Module#isOpen open} to at least the {@code java.xml.bind} module.
|
||||
* Can be empty, in which case a {@link JAXBContext} that only knows about
|
||||
* spec-defined classes will be returned.
|
||||
*
|
||||
* @return
|
||||
* A new instance of a {@code JAXBContext}.
|
||||
*
|
||||
* @throws JAXBException if an error was encountered while creating the
|
||||
* {@code JAXBContext}. See {@link JAXBContext#newInstance(Class[], Map)} for details.
|
||||
* @throws JAXBException
|
||||
* if an error was encountered while creating the
|
||||
* {@code JAXBContext}, such as (but not limited to):
|
||||
* <ol>
|
||||
* <li>No JAXB implementation was discovered
|
||||
* <li>Classes use JAXB annotations incorrectly
|
||||
* <li>Classes have colliding annotations (i.e., two classes with the same type name)
|
||||
* <li>The JAXB implementation was unable to locate
|
||||
* provider-specific out-of-band information (such as additional
|
||||
* files generated at the development time.)
|
||||
* <li>{@code classesToBeBound} are not open to {@code java.xml.bind} module
|
||||
* </ol>
|
||||
*
|
||||
* @throws IllegalArgumentException
|
||||
* if the parameter contains {@code null} (i.e., {@code newInstance(null);})
|
||||
@ -621,7 +659,9 @@ public abstract class JAXBContext {
|
||||
* throw {@code JAXBException} if it finds properties that it doesn't understand.
|
||||
*
|
||||
* @param classesToBeBound
|
||||
* list of java classes to be recognized by the new {@link JAXBContext}.
|
||||
* List of java classes to be recognized by the new {@link JAXBContext}.
|
||||
* Classes in {@code classesToBeBound} that are in named modules must be in a package
|
||||
* that is {@linkplain java.lang.Module#isOpen open} to at least the {@code java.xml.bind} module.
|
||||
* Can be empty, in which case a {@link JAXBContext} that only knows about
|
||||
* spec-defined classes will be returned.
|
||||
* @param properties
|
||||
@ -641,6 +681,7 @@ public abstract class JAXBContext {
|
||||
* <li>The JAXB implementation was unable to locate
|
||||
* provider-specific out-of-band information (such as additional
|
||||
* files generated at the development time.)
|
||||
* <li>{@code classesToBeBound} are not open to {@code java.xml.bind} module
|
||||
* </ol>
|
||||
*
|
||||
* @throws IllegalArgumentException
|
||||
@ -702,6 +743,7 @@ public abstract class JAXBContext {
|
||||
* {@code Validator} object
|
||||
* @deprecated since JAXB2.0
|
||||
*/
|
||||
@Deprecated
|
||||
public abstract Validator createValidator() throws JAXBException;
|
||||
|
||||
/**
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -44,7 +44,9 @@ public interface JAXBContextFactory {
|
||||
* For semantics see {@link javax.xml.bind.JAXBContext#newInstance(Class[], java.util.Map)}
|
||||
*
|
||||
* @param classesToBeBound
|
||||
* list of java classes to be recognized by the new {@link JAXBContext}.
|
||||
* List of java classes to be recognized by the new {@link JAXBContext}.
|
||||
* Classes in {@code classesToBeBound} that are in named modules must be in a package
|
||||
* that is {@linkplain java.lang.Module#isOpen open} to at least the {@code java.xml.bind} module.
|
||||
* Can be empty, in which case a {@link JAXBContext} that only knows about
|
||||
* spec-defined classes will be returned.
|
||||
* @param properties
|
||||
@ -56,7 +58,16 @@ public interface JAXBContextFactory {
|
||||
*
|
||||
* @throws JAXBException
|
||||
* if an error was encountered while creating the
|
||||
* {@code JAXBContext}. See {@link JAXBContext#newInstance(Class[], Map)} for details.
|
||||
* {@code JAXBContext}, such as (but not limited to):
|
||||
* <ol>
|
||||
* <li>No JAXB implementation was discovered
|
||||
* <li>Classes use JAXB annotations incorrectly
|
||||
* <li>Classes have colliding annotations (i.e., two classes with the same type name)
|
||||
* <li>The JAXB implementation was unable to locate
|
||||
* provider-specific out-of-band information (such as additional
|
||||
* files generated at the development time.)
|
||||
* <li>{@code classesToBeBound} are not open to {@code java.xml.bind} module
|
||||
* </ol>
|
||||
*
|
||||
* @throws IllegalArgumentException
|
||||
* if the parameter contains {@code null} (i.e., {@code newInstance(null,someMap);})
|
||||
@ -77,7 +88,10 @@ public interface JAXBContextFactory {
|
||||
* The interpretation of properties is up to implementations. Implementations must
|
||||
* throw {@code JAXBException} if it finds properties that it doesn't understand.
|
||||
*
|
||||
* @param contextPath list of java package names that contain schema derived classes
|
||||
* @param contextPath
|
||||
* List of java package names that contain schema derived classes.
|
||||
* Classes in {@code classesToBeBound} that are in named modules must be in a package
|
||||
* that is {@linkplain java.lang.Module#isOpen open} to at least the {@code java.xml.bind} module.
|
||||
* @param classLoader
|
||||
* This class loader will be used to locate the implementation classes.
|
||||
* @param properties
|
||||
@ -86,7 +100,14 @@ public interface JAXBContextFactory {
|
||||
*
|
||||
* @return a new instance of a {@code JAXBContext}
|
||||
* @throws JAXBException if an error was encountered while creating the
|
||||
* {@code JAXBContext}. See {@link JAXBContext#newInstance(String, ClassLoader, Map)} for details.
|
||||
* {@code JAXBContext} such as
|
||||
* <ol>
|
||||
* <li>failure to locate either ObjectFactory.class or jaxb.index in the packages</li>
|
||||
* <li>an ambiguity among global elements contained in the contextPath</li>
|
||||
* <li>failure to locate a value for the context factory provider property</li>
|
||||
* <li>mixing schema derived packages from different providers on the same contextPath</li>
|
||||
* <li>packages are not open to {@code java.xml.bind} module</li>
|
||||
* </ol>
|
||||
*
|
||||
* @since 9, JAXB 2.3
|
||||
*/
|
||||
|
@ -91,4 +91,10 @@ class Messages
|
||||
|
||||
static final String ILLEGAL_CAST = // 2 args
|
||||
"JAXBContext.IllegalCast";
|
||||
|
||||
static final String ERROR_LOAD_CLASS = // 2 args
|
||||
"ContextFinder.ErrorLoadClass";
|
||||
|
||||
static final String JAXB_CLASSES_NOT_OPEN = // 1 arg
|
||||
"JAXBClasses.notOpen";
|
||||
}
|
||||
|
@ -44,6 +44,11 @@ ContextFinder.MissingProperty = \
|
||||
ContextFinder.NoPackageInContextPath = \
|
||||
No package name is given
|
||||
|
||||
ContextFinder.ErrorLoadClass = \
|
||||
Error loading class {0} listed in {1}, make sure that entries are accessable \
|
||||
on CLASSPATH and of the form ClassName or OuterClass.InnerClass \
|
||||
not ClassName.class or fully.qualified.ClassName
|
||||
|
||||
PropertyException.NameValue = \
|
||||
name: {0} value: {1}
|
||||
|
||||
@ -52,3 +57,6 @@ DatatypeConverter.ConverterMustNotBeNull = \
|
||||
|
||||
JAXBContext.IllegalCast = \
|
||||
ClassCastException: attempting to cast {0} to {1}. Please make sure that you are specifying the proper ClassLoader.
|
||||
|
||||
JAXBClasses.notOpen = \
|
||||
Package {0} with JAXB class {1} defined in a module {2} must be open to at least java.xml.bind module.
|
||||
|
@ -0,0 +1,160 @@
|
||||
/*
|
||||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package javax.xml.bind;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.lang.Module;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
/**
|
||||
* Propagates openness of JAXB annottated classess packages to JAXB impl module.
|
||||
*
|
||||
* @author Roman Grigoriadi
|
||||
*/
|
||||
class ModuleUtil {
|
||||
|
||||
private static Logger logger = Logger.getLogger("javax.xml.bind");
|
||||
|
||||
/**
|
||||
* Resolves classes from context path.
|
||||
* Only one class per package is needed to access its {@link java.lang.Module}
|
||||
*/
|
||||
static Class[] getClassesFromContextPath(String contextPath, ClassLoader classLoader) throws JAXBException {
|
||||
List<Class> classes = new ArrayList<>();
|
||||
if (contextPath == null || contextPath.isEmpty()){
|
||||
return classes.toArray(new Class[]{});
|
||||
}
|
||||
|
||||
String [] tokens = contextPath.split(":");
|
||||
for (String pkg : tokens){
|
||||
|
||||
// look for ObjectFactory and load it
|
||||
final Class<?> o;
|
||||
try {
|
||||
o = classLoader.loadClass(pkg+".ObjectFactory");
|
||||
classes.add(o);
|
||||
continue;
|
||||
} catch (ClassNotFoundException e) {
|
||||
// not necessarily an error
|
||||
}
|
||||
|
||||
// look for jaxb.index and load the list of classes
|
||||
try {
|
||||
final Class firstByJaxbIndex = findFirstByJaxbIndex(pkg, classLoader);
|
||||
if (firstByJaxbIndex != null) {
|
||||
classes.add(firstByJaxbIndex);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw new JAXBException(e);
|
||||
}
|
||||
}
|
||||
|
||||
if (logger.isLoggable(Level.FINE)) {
|
||||
logger.log(Level.FINE, "Resolved classes from context path: {0}", classes);
|
||||
}
|
||||
return classes.toArray(new Class[]{});
|
||||
}
|
||||
|
||||
/**
|
||||
* Find first class in package by {@code jaxb.index} file.
|
||||
*/
|
||||
static Class findFirstByJaxbIndex(String pkg, ClassLoader classLoader) throws IOException, JAXBException {
|
||||
final String resource = pkg.replace('.', '/') + "/jaxb.index";
|
||||
final InputStream resourceAsStream = classLoader.getResourceAsStream(resource);
|
||||
|
||||
if (resourceAsStream == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
BufferedReader in =
|
||||
new BufferedReader(new InputStreamReader(resourceAsStream, "UTF-8"));
|
||||
try {
|
||||
String className = in.readLine();
|
||||
while (className != null) {
|
||||
className = className.trim();
|
||||
if (className.startsWith("#") || (className.length() == 0)) {
|
||||
className = in.readLine();
|
||||
continue;
|
||||
}
|
||||
|
||||
try {
|
||||
return classLoader.loadClass(pkg + '.' + className);
|
||||
} catch (ClassNotFoundException e) {
|
||||
throw new JAXBException(Messages.format(Messages.ERROR_LOAD_CLASS, className, pkg), e);
|
||||
}
|
||||
|
||||
}
|
||||
} finally {
|
||||
in.close();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation may be defined in other module than {@code java.xml.bind}. In that case openness
|
||||
* {@linkplain Module#isOpen open} of classes should be delegated to implementation module.
|
||||
*
|
||||
* @param classes used to resolve module for {@linkplain Module#addOpens(String, Module)}
|
||||
* @param factorySPI used to resolve {@link Module} of the implementation.
|
||||
*
|
||||
* @throws JAXBException if ony of a classes package is not open to {@code java.xml.bind} module.
|
||||
*/
|
||||
static void delegateAddOpensToImplModule(Class[] classes, Class<?> factorySPI) throws JAXBException {
|
||||
final Module implModule = factorySPI.getModule();
|
||||
if (!implModule.isNamed()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Module jaxbModule = JAXBContext.class.getModule();
|
||||
|
||||
for (Class cls : classes) {
|
||||
final Module classModule = cls.getModule();
|
||||
final String packageName = cls.getPackageName();
|
||||
//no need for unnamed
|
||||
if (!classModule.isNamed()) {
|
||||
continue;
|
||||
}
|
||||
//report error if they are not open to java.xml.bind
|
||||
if (!classModule.isOpen(packageName, jaxbModule)) {
|
||||
throw new JAXBException(Messages.format(Messages.JAXB_CLASSES_NOT_OPEN,
|
||||
packageName, cls.getName(), classModule.getName()));
|
||||
}
|
||||
//propagate openness to impl module
|
||||
classModule.addOpens(packageName, implModule);
|
||||
if (logger.isLoggable(Level.FINE)) {
|
||||
logger.log(Level.FINE, "Propagating openness of package {0} in {1} to {2}.",
|
||||
new String[]{ packageName, classModule.getName(), implModule.getName() });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -23,6 +23,8 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
package javax.xml.bind;
|
||||
|
||||
import javax.xml.bind.annotation.adapters.XmlAdapter;
|
||||
@ -975,7 +977,6 @@ public interface Unmarshaller {
|
||||
* {@link #isValidating()} API as well as access to the Schema object.
|
||||
* To determine if the Unmarshaller has validation enabled, simply
|
||||
* test the return type for null:
|
||||
* <p>
|
||||
* <pre>{@code
|
||||
* boolean isValidating = u.getSchema()!=null;
|
||||
* }</pre>
|
||||
|
@ -76,6 +76,7 @@ class HttpSOAPConnection extends SOAPConnection {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() throws SOAPException {
|
||||
if (closed) {
|
||||
log.severe("SAAJ0002.p2p.close.already.closed.conn");
|
||||
@ -86,6 +87,7 @@ class HttpSOAPConnection extends SOAPConnection {
|
||||
closed = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SOAPMessage call(SOAPMessage message, Object endPoint)
|
||||
throws SOAPException {
|
||||
if (closed) {
|
||||
@ -348,6 +350,7 @@ class HttpSOAPConnection extends SOAPConnection {
|
||||
// Object identifies where the request should be sent.
|
||||
// It is required to support objects of type String and java.net.URL.
|
||||
|
||||
@Override
|
||||
public SOAPMessage get(Object endPoint) throws SOAPException {
|
||||
if (closed) {
|
||||
log.severe("SAAJ0011.p2p.get.already.closed.conn");
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -34,6 +34,7 @@ import javax.xml.soap.*;
|
||||
*/
|
||||
public class HttpSOAPConnectionFactory extends SOAPConnectionFactory {
|
||||
|
||||
@Override
|
||||
public SOAPConnection createConnection()
|
||||
throws SOAPException
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -116,6 +116,7 @@ public class MessagingException extends Exception {
|
||||
* Produce the message, include the message from the nested
|
||||
* exception if there is one.
|
||||
*/
|
||||
@Override
|
||||
public String getMessage() {
|
||||
if (next == null)
|
||||
return super.getMessage();
|
||||
|
@ -28,18 +28,20 @@
|
||||
*/
|
||||
|
||||
|
||||
|
||||
package com.sun.xml.internal.messaging.saaj.packaging.mime.internet;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.BitSet;
|
||||
import com.sun.xml.internal.messaging.saaj.packaging.mime.MessagingException;
|
||||
import com.sun.xml.internal.messaging.saaj.packaging.mime.util.ASCIIUtility;
|
||||
import com.sun.xml.internal.messaging.saaj.packaging.mime.util.OutputUtil;
|
||||
import com.sun.xml.internal.messaging.saaj.util.ByteOutputStream;
|
||||
|
||||
import javax.activation.DataSource;
|
||||
|
||||
import com.sun.xml.internal.messaging.saaj.packaging.mime.*;
|
||||
import com.sun.xml.internal.messaging.saaj.packaging.mime.util.*;
|
||||
|
||||
import com.sun.xml.internal.messaging.saaj.util.ByteOutputStream;
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.BitSet;
|
||||
|
||||
/**
|
||||
* The MimeMultipart class is an implementation of the abstract Multipart
|
||||
@ -67,11 +69,10 @@ import com.sun.xml.internal.messaging.saaj.util.ByteOutputStream;
|
||||
* subtype by using the <code>MimeMultipart(String subtype)</code>
|
||||
* constructor. For example, to create a "multipart/alternative" object,
|
||||
* use <code>new MimeMultipart("alternative")</code>.
|
||||
*
|
||||
*/
|
||||
|
||||
//TODO: cleanup the SharedInputStream handling
|
||||
public class BMMimeMultipart extends MimeMultipart {
|
||||
public class BMMimeMultipart extends MimeMultipart {
|
||||
|
||||
/*
|
||||
* When true it indicates parsing hasnt been done at all
|
||||
@ -120,12 +121,12 @@ public class BMMimeMultipart extends MimeMultipart {
|
||||
*/
|
||||
public BMMimeMultipart(String subtype) {
|
||||
super(subtype);
|
||||
/*
|
||||
* Compute a boundary string.
|
||||
String boundary = UniqueValue.getUniqueBoundaryValue();
|
||||
ContentType cType = new ContentType("multipart", subtype, null);
|
||||
/*
|
||||
* Compute a boundary string.
|
||||
String boundary = UniqueValue.getUniqueBoundaryValue();
|
||||
ContentType cType = new ContentType("multipart", subtype, null);
|
||||
contentType.setParameter("boundary", boundary);
|
||||
*/
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
@ -144,25 +145,25 @@ public class BMMimeMultipart extends MimeMultipart {
|
||||
* skips the 'preamble' and reads bytes till the terminating
|
||||
* boundary and creates MimeBodyParts for each part of the stream.
|
||||
*
|
||||
* @param ds DataSource, can be a MultipartDataSource.
|
||||
* @param ct content type.
|
||||
* @exception MessagingException in case of error.
|
||||
* @param ct content type.
|
||||
* @param ds DataSource, can be a MultipartDataSource.
|
||||
* @throws MessagingException in case of error.
|
||||
*/
|
||||
public BMMimeMultipart(DataSource ds, ContentType ct)
|
||||
throws MessagingException {
|
||||
super(ds,ct);
|
||||
throws MessagingException {
|
||||
super(ds, ct);
|
||||
boundary = ct.getParameter("boundary");
|
||||
/*
|
||||
if (ds instanceof MultipartDataSource) {
|
||||
// ask super to do this for us.
|
||||
setMultipartDataSource((MultipartDataSource)ds);
|
||||
return;
|
||||
}
|
||||
if (ds instanceof MultipartDataSource) {
|
||||
// ask super to do this for us.
|
||||
setMultipartDataSource((MultipartDataSource)ds);
|
||||
return;
|
||||
}
|
||||
|
||||
// 'ds' was not a MultipartDataSource, we have
|
||||
// to parse this ourself.
|
||||
parsed = false;
|
||||
this.ds = ds;
|
||||
// 'ds' was not a MultipartDataSource, we have
|
||||
// to parse this ourself.
|
||||
parsed = false;
|
||||
this.ds = ds;
|
||||
if (ct==null)
|
||||
contentType = new ContentType(ds.getContentType());
|
||||
else
|
||||
@ -177,8 +178,8 @@ public class BMMimeMultipart extends MimeMultipart {
|
||||
try {
|
||||
in = ds.getInputStream();
|
||||
if (!(in instanceof ByteArrayInputStream) &&
|
||||
!(in instanceof BufferedInputStream) &&
|
||||
!(in instanceof SharedInputStream))
|
||||
!(in instanceof BufferedInputStream) &&
|
||||
!(in instanceof SharedInputStream))
|
||||
in = new BufferedInputStream(in);
|
||||
} catch (Exception ex) {
|
||||
throw new MessagingException("No inputstream from datasource");
|
||||
@ -186,7 +187,7 @@ public class BMMimeMultipart extends MimeMultipart {
|
||||
|
||||
if (!in.markSupported()) {
|
||||
throw new MessagingException(
|
||||
"InputStream does not support Marking");
|
||||
"InputStream does not support Marking");
|
||||
}
|
||||
}
|
||||
return in;
|
||||
@ -199,10 +200,10 @@ public class BMMimeMultipart extends MimeMultipart {
|
||||
* method is called by all other methods that need data for
|
||||
* the body parts, to make sure the data has been parsed.
|
||||
*
|
||||
* @since JavaMail 1.2
|
||||
* @since JavaMail 1.2
|
||||
*/
|
||||
@Override
|
||||
protected void parse() throws MessagingException {
|
||||
protected void parse() throws MessagingException {
|
||||
if (parsed)
|
||||
return;
|
||||
|
||||
@ -210,7 +211,7 @@ public class BMMimeMultipart extends MimeMultipart {
|
||||
|
||||
SharedInputStream sin = null;
|
||||
if (in instanceof SharedInputStream) {
|
||||
sin = (SharedInputStream)in;
|
||||
sin = (SharedInputStream) in;
|
||||
}
|
||||
|
||||
String bnd = "--" + boundary;
|
||||
@ -231,8 +232,8 @@ public class BMMimeMultipart extends MimeMultipart {
|
||||
}
|
||||
|
||||
public MimeBodyPart getNextPart(
|
||||
InputStream stream, byte[] pattern, SharedInputStream sin)
|
||||
throws Exception {
|
||||
InputStream stream, byte[] pattern, SharedInputStream sin)
|
||||
throws Exception {
|
||||
|
||||
if (!stream.markSupported()) {
|
||||
throw new Exception("InputStream does not support Marking");
|
||||
@ -242,7 +243,7 @@ public class BMMimeMultipart extends MimeMultipart {
|
||||
compile(pattern);
|
||||
if (!skipPreamble(stream, pattern, sin)) {
|
||||
throw new Exception(
|
||||
"Missing Start Boundary, or boundary does not start on a new line");
|
||||
"Missing Start Boundary, or boundary does not start on a new line");
|
||||
}
|
||||
begining = false;
|
||||
}
|
||||
@ -256,7 +257,7 @@ public class BMMimeMultipart extends MimeMultipart {
|
||||
b = readHeaders(stream);
|
||||
if (b == -1) {
|
||||
throw new Exception(
|
||||
"End of Stream encountered while reading part headers");
|
||||
"End of Stream encountered while reading part headers");
|
||||
}
|
||||
long[] v = new long[1];
|
||||
v[0] = -1; // just to ensure the code later sets it correctly
|
||||
@ -276,7 +277,7 @@ public class BMMimeMultipart extends MimeMultipart {
|
||||
} else {
|
||||
InternetHeaders headers = createInternetHeaders(stream);
|
||||
ByteOutputStream baos = new ByteOutputStream();
|
||||
b = readBody(stream, pattern, null,baos, null);
|
||||
b = readBody(stream, pattern, null, baos, null);
|
||||
// looks like this check has to be disabled
|
||||
// in the old impl it is allowed to have Mime Package
|
||||
// without closing boundary
|
||||
@ -286,7 +287,7 @@ public class BMMimeMultipart extends MimeMultipart {
|
||||
}
|
||||
}
|
||||
MimeBodyPart mbp = createMimeBodyPart(
|
||||
headers, baos.getBytes(), baos.getCount());
|
||||
headers, baos.getBytes(), baos.getCount());
|
||||
addBodyPart(mbp);
|
||||
return mbp;
|
||||
}
|
||||
@ -294,11 +295,11 @@ public class BMMimeMultipart extends MimeMultipart {
|
||||
}
|
||||
|
||||
public boolean parse(
|
||||
InputStream stream, byte[] pattern, SharedInputStream sin)
|
||||
throws Exception {
|
||||
InputStream stream, byte[] pattern, SharedInputStream sin)
|
||||
throws Exception {
|
||||
|
||||
while (!lastPartFound.get(0) && (b != -1)) {
|
||||
getNextPart(stream, pattern, sin);
|
||||
getNextPart(stream, pattern, sin);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -307,7 +308,7 @@ public class BMMimeMultipart extends MimeMultipart {
|
||||
// if the headers are to end properly then there has to be CRLF
|
||||
// actually we just need to mark the start and end positions
|
||||
int b = is.read();
|
||||
while(b != -1) {
|
||||
while (b != -1) {
|
||||
// when it is a shared input stream no need to copy
|
||||
if (b == '\r') {
|
||||
b = is.read();
|
||||
@ -316,7 +317,7 @@ public class BMMimeMultipart extends MimeMultipart {
|
||||
if (b == '\r') {
|
||||
b = is.read();
|
||||
if (b == '\n') {
|
||||
return b;
|
||||
return b;
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
@ -331,43 +332,43 @@ public class BMMimeMultipart extends MimeMultipart {
|
||||
}
|
||||
if (b == -1) {
|
||||
throw new Exception(
|
||||
"End of inputstream while reading Mime-Part Headers");
|
||||
"End of inputstream while reading Mime-Part Headers");
|
||||
}
|
||||
return b;
|
||||
}
|
||||
|
||||
private int readBody(
|
||||
InputStream is, byte[] pattern, long[] posVector,
|
||||
ByteOutputStream baos, SharedInputStream sin)
|
||||
throws Exception {
|
||||
InputStream is, byte[] pattern, long[] posVector,
|
||||
ByteOutputStream baos, SharedInputStream sin)
|
||||
throws Exception {
|
||||
if (!find(is, pattern, posVector, baos, sin)) {
|
||||
throw new Exception(
|
||||
"Missing boundary delimitier while reading Body Part");
|
||||
"Missing boundary delimitier while reading Body Part");
|
||||
}
|
||||
return b;
|
||||
}
|
||||
|
||||
private boolean skipPreamble(
|
||||
InputStream is, byte[] pattern, SharedInputStream sin)
|
||||
throws Exception {
|
||||
InputStream is, byte[] pattern, SharedInputStream sin)
|
||||
throws Exception {
|
||||
if (!find(is, pattern, sin)) {
|
||||
return false;
|
||||
}
|
||||
if (lastPartFound.get(0)) {
|
||||
throw new Exception(
|
||||
"Found closing boundary delimiter while trying to skip preamble");
|
||||
"Found closing boundary delimiter while trying to skip preamble");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public int readNext(InputStream is, byte[] buff, int patternLength,
|
||||
BitSet eof, long[] posVector, SharedInputStream sin)
|
||||
throws Exception {
|
||||
public int readNext(InputStream is, byte[] buff, int patternLength,
|
||||
BitSet eof, long[] posVector, SharedInputStream sin)
|
||||
throws Exception {
|
||||
|
||||
int bufferLength = is.read(buffer, 0, patternLength);
|
||||
if (bufferLength == -1) {
|
||||
eof.flip(0);
|
||||
eof.flip(0);
|
||||
} else if (bufferLength < patternLength) {
|
||||
//repeatedly read patternLength - bufferLength
|
||||
int temp = 0;
|
||||
@ -385,18 +386,18 @@ public class BMMimeMultipart extends MimeMultipart {
|
||||
}
|
||||
break;
|
||||
}
|
||||
buffer[i] = (byte)temp;
|
||||
buffer[i] = (byte) temp;
|
||||
}
|
||||
bufferLength=i;
|
||||
bufferLength = i;
|
||||
}
|
||||
return bufferLength;
|
||||
}
|
||||
|
||||
public boolean find(InputStream is, byte[] pattern, SharedInputStream sin)
|
||||
throws Exception {
|
||||
throws Exception {
|
||||
int i;
|
||||
int l = pattern.length;
|
||||
int lx = l -1;
|
||||
int lx = l - 1;
|
||||
BitSet eof = new BitSet(1);
|
||||
long[] posVector = new long[1];
|
||||
|
||||
@ -409,12 +410,12 @@ public class BMMimeMultipart extends MimeMultipart {
|
||||
}
|
||||
|
||||
/*
|
||||
if (bufferLength < l) {
|
||||
//is.reset();
|
||||
return false;
|
||||
}*/
|
||||
if (bufferLength < l) {
|
||||
//is.reset();
|
||||
return false;
|
||||
}*/
|
||||
|
||||
for(i = lx; i >= 0; i--) {
|
||||
for (i = lx; i >= 0; i--) {
|
||||
if (buffer[i] != pattern[i]) {
|
||||
break;
|
||||
}
|
||||
@ -435,11 +436,11 @@ public class BMMimeMultipart extends MimeMultipart {
|
||||
}
|
||||
|
||||
public boolean find(
|
||||
InputStream is, byte[] pattern, long[] posVector,
|
||||
ByteOutputStream out, SharedInputStream sin) throws Exception {
|
||||
InputStream is, byte[] pattern, long[] posVector,
|
||||
ByteOutputStream out, SharedInputStream sin) throws Exception {
|
||||
int i;
|
||||
int l = pattern.length;
|
||||
int lx = l -1;
|
||||
int lx = l - 1;
|
||||
int bufferLength = 0;
|
||||
int s = 0;
|
||||
long endPos = -1;
|
||||
@ -466,7 +467,7 @@ public class BMMimeMultipart extends MimeMultipart {
|
||||
// looks like it is allowed to not have a closing boundary
|
||||
//return false;
|
||||
//if (sin != null) {
|
||||
// posVector[0] = endPos;
|
||||
// posVector[0] = endPos;
|
||||
//}
|
||||
b = -1;
|
||||
if ((s == l) && (sin == null)) {
|
||||
@ -482,7 +483,7 @@ public class BMMimeMultipart extends MimeMultipart {
|
||||
} else {
|
||||
// looks like it is allowed to not have a closing boundary
|
||||
// in the old implementation
|
||||
out.write(buffer, 0, bufferLength);
|
||||
out.write(buffer, 0, bufferLength);
|
||||
}
|
||||
// looks like it is allowed to not have a closing boundary
|
||||
// in the old implementation
|
||||
@ -491,7 +492,7 @@ public class BMMimeMultipart extends MimeMultipart {
|
||||
return true;
|
||||
}
|
||||
|
||||
for(i = lx; i >= 0; i--) {
|
||||
for (i = lx; i >= 0; i--) {
|
||||
if (buffer[i] != pattern[i]) {
|
||||
break;
|
||||
}
|
||||
@ -507,7 +508,7 @@ public class BMMimeMultipart extends MimeMultipart {
|
||||
if (s == 2) {
|
||||
if (prevBuffer[1] == '\n') {
|
||||
if (prevBuffer[0] != '\r' && prevBuffer[0] != '\n') {
|
||||
out.write(prevBuffer,0,1);
|
||||
out.write(prevBuffer, 0, 1);
|
||||
}
|
||||
if (sin != null) {
|
||||
posVector[0] = endPos;
|
||||
@ -516,15 +517,15 @@ public class BMMimeMultipart extends MimeMultipart {
|
||||
} else {
|
||||
throw new Exception(
|
||||
"Boundary characters encountered in part Body " +
|
||||
"without a preceeding CRLF");
|
||||
"without a preceeding CRLF");
|
||||
}
|
||||
|
||||
} else if (s==1) {
|
||||
} else if (s == 1) {
|
||||
if (prevBuffer[0] != '\n') {
|
||||
throw new Exception(
|
||||
"Boundary characters encountered in part Body " +
|
||||
"without a preceeding CRLF");
|
||||
}else {
|
||||
"without a preceeding CRLF");
|
||||
} else {
|
||||
if (sin != null) {
|
||||
posVector[0] = endPos;
|
||||
}
|
||||
@ -532,13 +533,13 @@ public class BMMimeMultipart extends MimeMultipart {
|
||||
}
|
||||
|
||||
} else if (s > 2) {
|
||||
if ((prevBuffer[s-2] == '\r') && (prevBuffer[s-1] == '\n')) {
|
||||
if ((prevBuffer[s - 2] == '\r') && (prevBuffer[s - 1] == '\n')) {
|
||||
if (sin != null) {
|
||||
posVector[0] = endPos - 2;
|
||||
} else {
|
||||
out.write(prevBuffer, 0, s - 2);
|
||||
}
|
||||
} else if (prevBuffer[s-1] == '\n') {
|
||||
} else if (prevBuffer[s - 1] == '\n') {
|
||||
//old impl allowed just a \n
|
||||
if (sin != null) {
|
||||
posVector[0] = endPos - 1;
|
||||
@ -547,8 +548,8 @@ public class BMMimeMultipart extends MimeMultipart {
|
||||
}
|
||||
} else {
|
||||
throw new Exception(
|
||||
"Boundary characters encountered in part Body " +
|
||||
"without a preceeding CRLF");
|
||||
"Boundary characters encountered in part Body " +
|
||||
"without a preceeding CRLF");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -561,22 +562,22 @@ public class BMMimeMultipart extends MimeMultipart {
|
||||
}
|
||||
|
||||
if ((s > 0) && (sin == null)) {
|
||||
if (prevBuffer[s-1] == (byte)13) {
|
||||
if (prevBuffer[s - 1] == (byte) 13) {
|
||||
// if buffer[0] == (byte)10
|
||||
if (buffer[0] == (byte)10) {
|
||||
if (buffer[0] == (byte) 10) {
|
||||
int j;
|
||||
for(j = lx-1; j > 0; j--) {
|
||||
if (buffer[j+1] != pattern[j]) {
|
||||
for (j = lx - 1; j > 0; j--) {
|
||||
if (buffer[j + 1] != pattern[j]) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (j == 0) {
|
||||
// matched the pattern excluding the last char of the pattern
|
||||
// so dont write the CR into stream
|
||||
out.write(prevBuffer,0,s-1);
|
||||
} else {
|
||||
out.write(prevBuffer,0,s);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (j == 0) {
|
||||
// matched the pattern excluding the last char of the pattern
|
||||
// so dont write the CR into stream
|
||||
out.write(prevBuffer, 0, s - 1);
|
||||
} else {
|
||||
out.write(prevBuffer, 0, s);
|
||||
}
|
||||
} else {
|
||||
out.write(prevBuffer, 0, s);
|
||||
}
|
||||
@ -612,20 +613,20 @@ public class BMMimeMultipart extends MimeMultipart {
|
||||
return true;
|
||||
} else {
|
||||
throw new Exception(
|
||||
"transport padding after a Mime Boundary should end in a CRLF, found CR only");
|
||||
"transport padding after a Mime Boundary should end in a CRLF, found CR only");
|
||||
}
|
||||
}
|
||||
|
||||
if (b == '-') {
|
||||
b = is.read();
|
||||
if (b != '-') {
|
||||
throw new Exception(
|
||||
"Unexpected singular '-' character after Mime Boundary");
|
||||
throw new Exception(
|
||||
"Unexpected singular '-' character after Mime Boundary");
|
||||
} else {
|
||||
//System.out.println("Last Part Found");
|
||||
lastPartFound.flip(0);
|
||||
// read the next char
|
||||
b = is.read();
|
||||
b = is.read();
|
||||
}
|
||||
}
|
||||
|
||||
@ -641,7 +642,7 @@ public class BMMimeMultipart extends MimeMultipart {
|
||||
b = is.read();
|
||||
}
|
||||
if (b == '\n') {
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -673,7 +674,8 @@ public class BMMimeMultipart extends MimeMultipart {
|
||||
|
||||
// Initialise Good Suffix Shift table
|
||||
gss = new int[l];
|
||||
NEXT: for (i = l; i > 0; i--) {
|
||||
NEXT:
|
||||
for (i = l; i > 0; i--) {
|
||||
// j is the beginning index of suffix being considered
|
||||
for (j = l - 1; j >= i; j--) {
|
||||
// Testing for good suffix
|
||||
@ -681,9 +683,9 @@ public class BMMimeMultipart extends MimeMultipart {
|
||||
// pattern[j..len] is a good suffix
|
||||
gss[j - 1] = i;
|
||||
} else {
|
||||
// No match. The array has already been
|
||||
// filled up with correct values before.
|
||||
continue NEXT;
|
||||
// No match. The array has already been
|
||||
// filled up with correct values before.
|
||||
continue NEXT;
|
||||
}
|
||||
}
|
||||
while (j > 0) {
|
||||
@ -756,6 +758,7 @@ public class BMMimeMultipart extends MimeMultipart {
|
||||
this.contentType.setParameter("boundary", bnd);
|
||||
}
|
||||
}
|
||||
|
||||
public String getBoundary() {
|
||||
return this.boundary;
|
||||
}
|
||||
|
@ -320,15 +320,15 @@ public final class InternetHeaders {
|
||||
* @return list of header lines.
|
||||
*/
|
||||
public List<String> getAllHeaderLines() {
|
||||
if(headerValueView==null)
|
||||
if (headerValueView == null)
|
||||
headerValueView = new AbstractList<String>() {
|
||||
@Override
|
||||
public String get(int index) {
|
||||
public String get(int index) {
|
||||
return headers.get(index).line;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int size() {
|
||||
public int size() {
|
||||
return headers.size();
|
||||
}
|
||||
};
|
||||
|
@ -31,15 +31,21 @@
|
||||
|
||||
package com.sun.xml.internal.messaging.saaj.packaging.mime.internet;
|
||||
|
||||
import java.io.*;
|
||||
import com.sun.xml.internal.messaging.saaj.packaging.mime.MessagingException;
|
||||
import com.sun.xml.internal.messaging.saaj.packaging.mime.MultipartDataSource;
|
||||
import com.sun.xml.internal.messaging.saaj.packaging.mime.util.ASCIIUtility;
|
||||
import com.sun.xml.internal.messaging.saaj.packaging.mime.util.LineInputStream;
|
||||
import com.sun.xml.internal.messaging.saaj.packaging.mime.util.OutputUtil;
|
||||
import com.sun.xml.internal.messaging.saaj.util.ByteOutputStream;
|
||||
import com.sun.xml.internal.messaging.saaj.util.FinalArrayList;
|
||||
import com.sun.xml.internal.messaging.saaj.util.SAAJUtil;
|
||||
|
||||
import javax.activation.DataSource;
|
||||
|
||||
import com.sun.xml.internal.messaging.saaj.packaging.mime.*;
|
||||
import com.sun.xml.internal.messaging.saaj.packaging.mime.util.*;
|
||||
import com.sun.xml.internal.messaging.saaj.util.FinalArrayList;
|
||||
import com.sun.xml.internal.messaging.saaj.util.ByteOutputStream;
|
||||
import com.sun.xml.internal.messaging.saaj.util.SAAJUtil;
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
|
||||
/**
|
||||
* The MimeMultipart class is an implementation
|
||||
@ -211,7 +217,7 @@ public class MimeMultipart {
|
||||
* @exception MessagingException if no such MimeBodyPart exists
|
||||
*/
|
||||
public MimeBodyPart getBodyPart(int index)
|
||||
throws MessagingException {
|
||||
throws MessagingException {
|
||||
parse();
|
||||
if (parts == null)
|
||||
throw new IndexOutOfBoundsException("No such BodyPart");
|
||||
@ -228,19 +234,19 @@ public class MimeMultipart {
|
||||
* @exception MessagingException if no such MimeBodyPart exists.
|
||||
*/
|
||||
public MimeBodyPart getBodyPart(String CID)
|
||||
throws MessagingException {
|
||||
throws MessagingException {
|
||||
parse();
|
||||
|
||||
int count = getCount();
|
||||
for (int i = 0; i < count; i++) {
|
||||
MimeBodyPart part = getBodyPart(i);
|
||||
String s = part.getContentID();
|
||||
// Old versions of AXIS2 put angle brackets around the content
|
||||
// id but not the start param
|
||||
String sNoAngle = (s!= null) ? s.replaceFirst("^<", "").replaceFirst(">$", "")
|
||||
:null;
|
||||
// Old versions of AXIS2 put angle brackets around the content
|
||||
// id but not the start param
|
||||
String sNoAngle = (s!= null) ? s.replaceFirst("^<", "").replaceFirst(">$", "")
|
||||
:null;
|
||||
if (s != null && (s.equals(CID) || CID.equals(sNoAngle)))
|
||||
return part;
|
||||
return part;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -319,14 +325,14 @@ public class MimeMultipart {
|
||||
try {
|
||||
in = ds.getInputStream();
|
||||
if (!(in instanceof ByteArrayInputStream) &&
|
||||
!(in instanceof BufferedInputStream) &&
|
||||
!(in instanceof SharedInputStream))
|
||||
!(in instanceof BufferedInputStream) &&
|
||||
!(in instanceof SharedInputStream))
|
||||
in = new BufferedInputStream(in);
|
||||
} catch (Exception ex) {
|
||||
throw new MessagingException("No inputstream from datasource");
|
||||
}
|
||||
if (in instanceof SharedInputStream)
|
||||
sin = (SharedInputStream)in;
|
||||
sin = (SharedInputStream) in;
|
||||
|
||||
String boundary = "--" + contentType.getParameter("boundary");
|
||||
byte[] bndbytes = ASCIIUtility.getBytes(boundary);
|
||||
@ -338,12 +344,12 @@ public class MimeMultipart {
|
||||
LineInputStream lin = new LineInputStream(in);
|
||||
String line;
|
||||
while ((line = lin.readLine()) != null) {
|
||||
/*
|
||||
* Strip trailing whitespace. Can't use trim method
|
||||
* because it's too aggressive. Some bogus MIME
|
||||
* messages will include control characters in the
|
||||
* boundary string.
|
||||
*/
|
||||
/*
|
||||
* Strip trailing whitespace. Can't use trim method
|
||||
* because it's too aggressive. Some bogus MIME
|
||||
* messages will include control characters in the
|
||||
* boundary string.
|
||||
*/
|
||||
int i;
|
||||
for (i = line.length() - 1; i >= 0; i--) {
|
||||
char c = line.charAt(i);
|
||||
@ -357,12 +363,12 @@ public class MimeMultipart {
|
||||
if (line == null)
|
||||
throw new MessagingException("Missing start boundary");
|
||||
|
||||
/*
|
||||
* Read and process body parts until we see the
|
||||
* terminating boundary line (or EOF).
|
||||
*/
|
||||
/*
|
||||
* Read and process body parts until we see the
|
||||
* terminating boundary line (or EOF).
|
||||
*/
|
||||
boolean done = false;
|
||||
getparts:
|
||||
getparts:
|
||||
while (!done) {
|
||||
InternetHeaders headers = null;
|
||||
if (sin != null) {
|
||||
@ -372,7 +378,7 @@ public class MimeMultipart {
|
||||
;
|
||||
if (line == null) {
|
||||
if (!ignoreMissingEndBoundary) {
|
||||
throw new MessagingException("Missing End Boundary for Mime Package : EOF while skipping headers");
|
||||
throw new MessagingException("Missing End Boundary for Mime Package : EOF while skipping headers");
|
||||
}
|
||||
// assume there's just a missing end boundary
|
||||
break getparts;
|
||||
@ -397,7 +403,7 @@ public class MimeMultipart {
|
||||
/*
|
||||
* Read and save the content bytes in buf.
|
||||
*/
|
||||
for (;;) {
|
||||
for (; ; ) {
|
||||
if (bol) {
|
||||
/*
|
||||
* At the beginning of a line, check whether the
|
||||
@ -416,7 +422,7 @@ public class MimeMultipart {
|
||||
if (in.read() == '-') {
|
||||
done = true;
|
||||
foundClosingBoundary = true;
|
||||
break; // ignore trailing text
|
||||
break; // ignore trailing text
|
||||
}
|
||||
}
|
||||
// skip linear whitespace
|
||||
@ -424,12 +430,12 @@ public class MimeMultipart {
|
||||
b2 = in.read();
|
||||
// check for end of line
|
||||
if (b2 == '\n')
|
||||
break; // got it! break out of the loop
|
||||
break; // got it! break out of the loop
|
||||
if (b2 == '\r') {
|
||||
in.mark(1);
|
||||
if (in.read() != '\n')
|
||||
in.reset();
|
||||
break; // got it! break out of the loop
|
||||
break; // got it! break out of the loop
|
||||
}
|
||||
}
|
||||
// failed to match, reset and proceed normally
|
||||
@ -491,7 +497,7 @@ public class MimeMultipart {
|
||||
buf.close();
|
||||
}
|
||||
|
||||
if (!ignoreMissingEndBoundary && !foundClosingBoundary && sin== null) {
|
||||
if (!ignoreMissingEndBoundary && !foundClosingBoundary && sin == null) {
|
||||
throw new MessagingException("Missing End Boundary for Mime Package : EOF while skipping headers");
|
||||
}
|
||||
parsed = true;
|
||||
@ -510,7 +516,7 @@ public class MimeMultipart {
|
||||
* @since JavaMail 1.2
|
||||
*/
|
||||
protected InternetHeaders createInternetHeaders(InputStream is)
|
||||
throws MessagingException {
|
||||
throws MessagingException {
|
||||
return new InternetHeaders(is);
|
||||
}
|
||||
|
||||
@ -523,12 +529,12 @@ public class MimeMultipart {
|
||||
*
|
||||
* @param headers the headers for the body part.
|
||||
* @param content the content of the body part.
|
||||
* @param len the content length.
|
||||
* @param len the content length.
|
||||
* @return MimeBodyPart
|
||||
* @since JavaMail 1.2
|
||||
*/
|
||||
protected MimeBodyPart createMimeBodyPart(InternetHeaders headers, byte[] content, int len) {
|
||||
return new MimeBodyPart(headers, content,len);
|
||||
return new MimeBodyPart(headers, content,len);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -544,7 +550,7 @@ public class MimeMultipart {
|
||||
* @since JavaMail 1.2
|
||||
*/
|
||||
protected MimeBodyPart createMimeBodyPart(InputStream is) throws MessagingException {
|
||||
return new MimeBodyPart(is);
|
||||
return new MimeBodyPart(is);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -564,7 +570,7 @@ public class MimeMultipart {
|
||||
* @exception MessagingException in case of error.
|
||||
*/
|
||||
protected void setMultipartDataSource(MultipartDataSource mp)
|
||||
throws MessagingException {
|
||||
throws MessagingException {
|
||||
contentType = new ContentType(mp.getContentType());
|
||||
|
||||
int count = mp.getCount();
|
||||
@ -582,7 +588,7 @@ public class MimeMultipart {
|
||||
* @see #contentType
|
||||
*/
|
||||
public ContentType getContentType() {
|
||||
return contentType;
|
||||
return contentType;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -28,21 +28,21 @@
|
||||
*/
|
||||
|
||||
|
||||
|
||||
package com.sun.xml.internal.messaging.saaj.packaging.mime.internet;
|
||||
|
||||
import java.io.*;
|
||||
import java.net.UnknownServiceException;
|
||||
import com.sun.xml.internal.messaging.saaj.packaging.mime.MessagingException;
|
||||
|
||||
import javax.activation.DataSource;
|
||||
|
||||
import com.sun.xml.internal.messaging.saaj.packaging.mime.MessagingException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.net.UnknownServiceException;
|
||||
|
||||
/**
|
||||
* A utility class that implements a DataSource out of
|
||||
* a MimeBodyPart. This class is primarily meant for service providers.
|
||||
*
|
||||
* @author John Mani
|
||||
* @author John Mani
|
||||
*/
|
||||
|
||||
public final class MimePartDataSource implements DataSource {
|
||||
@ -68,13 +68,13 @@ public final class MimePartDataSource implements DataSource {
|
||||
* using the <code>getContentStream()</code> method and decodes
|
||||
* it using the <code>MimeUtility.decode()</code> method.
|
||||
*
|
||||
* @return decoded input stream
|
||||
* @return decoded input stream
|
||||
*/
|
||||
@Override
|
||||
public InputStream getInputStream() throws IOException {
|
||||
|
||||
try {
|
||||
InputStream is = part.getContentStream();
|
||||
InputStream is = part.getContentStream();
|
||||
|
||||
String encoding = part.getEncoding();
|
||||
if (encoding != null)
|
||||
@ -92,7 +92,7 @@ public final class MimePartDataSource implements DataSource {
|
||||
* This implementation throws the UnknownServiceException.
|
||||
*/
|
||||
@Override
|
||||
public OutputStream getOutputStream() throws IOException {
|
||||
public OutputStream getOutputStream() throws IOException {
|
||||
throw new UnknownServiceException();
|
||||
}
|
||||
|
||||
@ -113,11 +113,11 @@ public final class MimePartDataSource implements DataSource {
|
||||
* This implementation just returns an empty string.
|
||||
*/
|
||||
@Override
|
||||
public String getName() {
|
||||
public String getName() {
|
||||
try {
|
||||
return part.getFileName();
|
||||
return part.getFileName();
|
||||
} catch (MessagingException mex) {
|
||||
return "";
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -113,6 +113,7 @@ public class MimePullMultipart extends MimeMultipart {
|
||||
parsed = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void parse() throws MessagingException {
|
||||
parseAll();
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -50,7 +50,7 @@ public final class ParameterList {
|
||||
* No-arg Constructor.
|
||||
*/
|
||||
public ParameterList() {
|
||||
this.list = new HashMap<String, String>();
|
||||
this.list = new HashMap<>();
|
||||
}
|
||||
|
||||
private ParameterList(HashMap<String, String> m) {
|
||||
@ -73,7 +73,7 @@ public final class ParameterList {
|
||||
int type;
|
||||
String name;
|
||||
|
||||
list = new HashMap<String, String>();
|
||||
list = new HashMap<>();
|
||||
while (true) {
|
||||
tk = h.next();
|
||||
type = tk.getType();
|
||||
@ -171,6 +171,7 @@ public final class ParameterList {
|
||||
*
|
||||
* @return String
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
return toString(0);
|
||||
}
|
||||
@ -232,6 +233,6 @@ public final class ParameterList {
|
||||
}
|
||||
|
||||
public ParameterList copy() {
|
||||
return new ParameterList((HashMap)list.clone());
|
||||
return new ParameterList((HashMap<String, String>)list.clone());
|
||||
}
|
||||
}
|
||||
|
@ -32,12 +32,14 @@ package com.sun.xml.internal.messaging.saaj.packaging.mime.util;
|
||||
|
||||
import com.sun.xml.internal.messaging.saaj.util.ByteOutputStream;
|
||||
|
||||
import java.io.*;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
public class ASCIIUtility {
|
||||
|
||||
// Private constructor so that this class is not instantiated
|
||||
private ASCIIUtility() { }
|
||||
private ASCIIUtility() {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@ -47,16 +49,14 @@ public class ASCIIUtility {
|
||||
*
|
||||
* Based on java.lang.Integer.parseInt().
|
||||
*
|
||||
* @param b bytes to convert to integer.
|
||||
* @param b bytes to convert to integer.
|
||||
* @param start start of the range.
|
||||
* @param end end of the range (not including).
|
||||
* @param end end of the range (not including).
|
||||
* @param radix radix.
|
||||
*
|
||||
* @return integer.
|
||||
*
|
||||
*/
|
||||
public static int parseInt(byte[] b, int start, int end, int radix)
|
||||
throws NumberFormatException {
|
||||
throws NumberFormatException {
|
||||
if (b == null)
|
||||
throw new NumberFormatException("null");
|
||||
|
||||
@ -77,18 +77,18 @@ public class ASCIIUtility {
|
||||
}
|
||||
multmin = limit / radix;
|
||||
if (i < end) {
|
||||
digit = Character.digit((char)b[i++], radix);
|
||||
digit = Character.digit((char) b[i++], radix);
|
||||
if (digit < 0) {
|
||||
throw new NumberFormatException(
|
||||
"illegal number: " + toString(b, start, end)
|
||||
);
|
||||
"illegal number: " + toString(b, start, end)
|
||||
);
|
||||
} else {
|
||||
result = -digit;
|
||||
}
|
||||
}
|
||||
while (i < end) {
|
||||
// Accumulating negatively avoids surprises near MAX_VALUE
|
||||
digit = Character.digit((char)b[i++], radix);
|
||||
digit = Character.digit((char) b[i++], radix);
|
||||
if (digit < 0) {
|
||||
throw new NumberFormatException("illegal number");
|
||||
}
|
||||
@ -120,56 +120,48 @@ public class ASCIIUtility {
|
||||
* array into a String. The range extends from <code>start</code>
|
||||
* till, but not including <code>end</code>.
|
||||
*
|
||||
* @param b bytes to convert to integer.
|
||||
* @param b bytes to convert to integer.
|
||||
* @param start start of the range.
|
||||
* @param end end of the range (not including).
|
||||
*
|
||||
* @param end end of the range (not including).
|
||||
* @return integer.
|
||||
*
|
||||
*/
|
||||
public static String toString(byte[] b, int start, int end) {
|
||||
int size = end - start;
|
||||
char[] theChars = new char[size];
|
||||
|
||||
for (int i = 0, j = start; i < size; )
|
||||
theChars[i++] = (char)(b[j++]&0xff);
|
||||
theChars[i++] = (char) (b[j++] & 0xff);
|
||||
|
||||
return new String(theChars);
|
||||
}
|
||||
|
||||
/**
|
||||
* Encodes specified String into a sequence of bytes using the platform's
|
||||
* default charset, storing the result into a new byte array.
|
||||
*
|
||||
* @param s string to encode into byte array.
|
||||
*
|
||||
* @return byte array.
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* Encodes specified String into a sequence of bytes using the platform's
|
||||
* default charset, storing the result into a new byte array.
|
||||
*
|
||||
* @param s string to encode into byte array.
|
||||
* @return byte array.
|
||||
*/
|
||||
public static byte[] getBytes(String s) {
|
||||
char [] chars= s.toCharArray();
|
||||
char[] chars = s.toCharArray();
|
||||
int size = chars.length;
|
||||
byte[] bytes = new byte[size];
|
||||
|
||||
for (int i = 0; i < size;)
|
||||
for (int i = 0; i < size; )
|
||||
bytes[i] = (byte) chars[i++];
|
||||
return bytes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts input stream to array.
|
||||
*
|
||||
* @param is stream to convert to array.
|
||||
*
|
||||
* @return byte array.
|
||||
*
|
||||
* @throws IOException if an I/O error occurs.
|
||||
* Converts input stream to array.
|
||||
*
|
||||
* @deprecated
|
||||
* this is an expensive operation that require an additional
|
||||
* buffer reallocation just to get the array of an exact size.
|
||||
* Unless you absolutely need the exact size array, don't use this.
|
||||
* Use {@link ByteOutputStream} and {@link ByteOutputStream#write(InputStream)}.
|
||||
* @param is stream to convert to array.
|
||||
* @return byte array.
|
||||
* @throws IOException if an I/O error occurs.
|
||||
* @deprecated this is an expensive operation that require an additional
|
||||
* buffer reallocation just to get the array of an exact size.
|
||||
* Unless you absolutely need the exact size array, don't use this.
|
||||
* Use {@link ByteOutputStream} and {@link ByteOutputStream#write(InputStream)}.
|
||||
*/
|
||||
@Deprecated
|
||||
public static byte[] getBytes(InputStream is) throws IOException {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -63,6 +63,7 @@ public class QDecoderStream extends QPDecoderStream {
|
||||
* stream is reached.
|
||||
* @exception IOException if an I/O error occurs.
|
||||
*/
|
||||
@Override
|
||||
public int read() throws IOException {
|
||||
int c = in.read();
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -67,6 +67,7 @@ public class QPDecoderStream extends FilterInputStream {
|
||||
* stream is reached.
|
||||
* @exception IOException if an I/O error occurs.
|
||||
*/
|
||||
@Override
|
||||
public int read() throws IOException {
|
||||
if (spaces > 0) {
|
||||
// We have cached space characters, return one
|
||||
@ -150,6 +151,7 @@ public class QPDecoderStream extends FilterInputStream {
|
||||
* the stream has been reached.
|
||||
* @exception IOException if an I/O error occurs.
|
||||
*/
|
||||
@Override
|
||||
public int read(byte[] buf, int off, int len) throws IOException {
|
||||
int i, c;
|
||||
for (i = 0; i < len; i++) {
|
||||
@ -167,6 +169,7 @@ public class QPDecoderStream extends FilterInputStream {
|
||||
* Tests if this input stream supports marks. Currently this class
|
||||
* does not support marks
|
||||
*/
|
||||
@Override
|
||||
public boolean markSupported() {
|
||||
return false;
|
||||
}
|
||||
@ -178,6 +181,7 @@ public class QPDecoderStream extends FilterInputStream {
|
||||
* this method just invokes the <code>available</code> method
|
||||
* of the original input stream.
|
||||
*/
|
||||
@Override
|
||||
public int available() throws IOException {
|
||||
// This is bogus ! We don't really know how much
|
||||
// bytes are available *after* decoding
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -81,6 +81,7 @@ public class QPEncoderStream extends FilterOutputStream {
|
||||
* @param len the number of bytes to write.
|
||||
* @exception IOException if an I/O error occurs.
|
||||
*/
|
||||
@Override
|
||||
public void write(byte[] b, int off, int len) throws IOException {
|
||||
for (int i = 0; i < len; i++)
|
||||
write(b[off + i]);
|
||||
@ -91,6 +92,7 @@ public class QPEncoderStream extends FilterOutputStream {
|
||||
* @param b the data to be written.
|
||||
* @exception IOException if an I/O error occurs.
|
||||
*/
|
||||
@Override
|
||||
public void write(byte[] b) throws IOException {
|
||||
write(b, 0, b.length);
|
||||
}
|
||||
@ -100,6 +102,7 @@ public class QPEncoderStream extends FilterOutputStream {
|
||||
* @param c the <code>byte</code>.
|
||||
* @exception IOException if an I/O error occurs.
|
||||
*/
|
||||
@Override
|
||||
public void write(int c) throws IOException {
|
||||
c = c & 0xff; // Turn off the MSB.
|
||||
if (gotSpace) { // previous character was <SPACE>
|
||||
@ -139,6 +142,7 @@ public class QPEncoderStream extends FilterOutputStream {
|
||||
* to be encoded out to the stream.
|
||||
* @exception IOException if an I/O error occurs.
|
||||
*/
|
||||
@Override
|
||||
public void flush() throws IOException {
|
||||
out.flush();
|
||||
}
|
||||
@ -147,6 +151,7 @@ public class QPEncoderStream extends FilterOutputStream {
|
||||
* Forces any buffered output bytes to be encoded out to the stream
|
||||
* and closes this output stream
|
||||
*/
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
out.close();
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -78,6 +78,7 @@ public class UUDecoderStream extends FilterInputStream {
|
||||
* @see java.io.FilterInputStream#in
|
||||
*/
|
||||
|
||||
@Override
|
||||
public int read() throws IOException {
|
||||
if (index >= bufsize) {
|
||||
readPrefix();
|
||||
@ -88,6 +89,7 @@ public class UUDecoderStream extends FilterInputStream {
|
||||
return buffer[index++] & 0xff; // return lower byte
|
||||
}
|
||||
|
||||
@Override
|
||||
public int read(byte[] buf, int off, int len) throws IOException {
|
||||
int i, c;
|
||||
for (i = 0; i < len; i++) {
|
||||
@ -101,10 +103,12 @@ public class UUDecoderStream extends FilterInputStream {
|
||||
return i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean markSupported() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int available() throws IOException {
|
||||
// This is only an estimate, since in.available()
|
||||
// might include CRLFs too ..
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -88,6 +88,7 @@ public class AttachmentPartImpl extends AttachmentPart {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSize() throws SOAPException {
|
||||
if (mimePart != null) {
|
||||
try {
|
||||
@ -124,6 +125,7 @@ public class AttachmentPartImpl extends AttachmentPart {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearContent() {
|
||||
if (mimePart != null) {
|
||||
mimePart.close();
|
||||
@ -133,6 +135,7 @@ public class AttachmentPartImpl extends AttachmentPart {
|
||||
rawContent = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getContent() throws SOAPException {
|
||||
try {
|
||||
if (mimePart != null) {
|
||||
@ -153,6 +156,7 @@ public class AttachmentPartImpl extends AttachmentPart {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setContent(Object object, String contentType)
|
||||
throws IllegalArgumentException {
|
||||
if (mimePart != null) {
|
||||
@ -165,23 +169,28 @@ public class AttachmentPartImpl extends AttachmentPart {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public DataHandler getDataHandler() throws SOAPException {
|
||||
if (mimePart != null) {
|
||||
//return an inputstream
|
||||
return new DataHandler(new DataSource() {
|
||||
|
||||
@Override
|
||||
public InputStream getInputStream() throws IOException {
|
||||
return mimePart.read();
|
||||
}
|
||||
|
||||
@Override
|
||||
public OutputStream getOutputStream() throws IOException {
|
||||
throw new UnsupportedOperationException("getOutputStream cannot be supported : You have enabled LazyAttachments Option");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getContentType() {
|
||||
return mimePart.getContentType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "MIMEPart Wrapper DataSource";
|
||||
}
|
||||
@ -197,6 +206,7 @@ public class AttachmentPartImpl extends AttachmentPart {
|
||||
return dataHandler;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDataHandler(DataHandler dataHandler)
|
||||
throws IllegalArgumentException {
|
||||
if (mimePart != null) {
|
||||
@ -216,35 +226,43 @@ public class AttachmentPartImpl extends AttachmentPart {
|
||||
setMimeHeader("Content-Type", dataHandler.getContentType());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeAllMimeHeaders() {
|
||||
headers.removeAllHeaders();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeMimeHeader(String header) {
|
||||
headers.removeHeader(header);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getMimeHeader(String name) {
|
||||
return headers.getHeader(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMimeHeader(String name, String value) {
|
||||
headers.setHeader(name, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addMimeHeader(String name, String value) {
|
||||
headers.addHeader(name, value);
|
||||
}
|
||||
|
||||
public Iterator getAllMimeHeaders() {
|
||||
@Override
|
||||
public Iterator<MimeHeader> getAllMimeHeaders() {
|
||||
return headers.getAllHeaders();
|
||||
}
|
||||
|
||||
public Iterator getMatchingMimeHeaders(String[] names) {
|
||||
@Override
|
||||
public Iterator<MimeHeader> getMatchingMimeHeaders(String[] names) {
|
||||
return headers.getMatchingHeaders(names);
|
||||
}
|
||||
|
||||
public Iterator getNonMatchingMimeHeaders(String[] names) {
|
||||
@Override
|
||||
public Iterator<MimeHeader> getNonMatchingMimeHeaders(String[] names) {
|
||||
return headers.getNonMatchingHeaders(names);
|
||||
}
|
||||
|
||||
@ -329,6 +347,7 @@ public class AttachmentPartImpl extends AttachmentPart {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBase64Content(InputStream content, String contentType)
|
||||
throws SOAPException {
|
||||
|
||||
@ -365,6 +384,7 @@ public class AttachmentPartImpl extends AttachmentPart {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public InputStream getBase64Content() throws SOAPException {
|
||||
InputStream stream;
|
||||
if (mimePart != null) {
|
||||
@ -425,6 +445,7 @@ public class AttachmentPartImpl extends AttachmentPart {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRawContent(InputStream content, String contentType)
|
||||
throws SOAPException {
|
||||
if (mimePart != null) {
|
||||
@ -475,6 +496,7 @@ public class AttachmentPartImpl extends AttachmentPart {
|
||||
}
|
||||
} */
|
||||
|
||||
@Override
|
||||
public void setRawContentBytes(
|
||||
byte[] content, int off, int len, String contentType)
|
||||
throws SOAPException {
|
||||
@ -498,6 +520,7 @@ public class AttachmentPartImpl extends AttachmentPart {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public InputStream getRawContent() throws SOAPException {
|
||||
if (mimePart != null) {
|
||||
return mimePart.read();
|
||||
@ -522,6 +545,7 @@ public class AttachmentPartImpl extends AttachmentPart {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] getRawContentBytes() throws SOAPException {
|
||||
InputStream ret;
|
||||
if (mimePart != null) {
|
||||
@ -556,12 +580,14 @@ public class AttachmentPartImpl extends AttachmentPart {
|
||||
}
|
||||
|
||||
// attachments are equal if they are the same reference
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
return (this == o);
|
||||
}
|
||||
|
||||
// In JDK 8 we get a warning if we implement equals() but not hashCode().
|
||||
// There is no intuitive value for this, the default one in Object is fine.
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return super.hashCode();
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -71,6 +71,7 @@ abstract class ContextClassloaderLocal<V> {
|
||||
|
||||
private static ClassLoader getContextClassLoader() {
|
||||
return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
|
||||
@Override
|
||||
public ClassLoader run() {
|
||||
ClassLoader cl = null;
|
||||
try {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -63,6 +63,7 @@ public class MessageFactoryImpl extends MessageFactory {
|
||||
return oldListener;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SOAPMessage createMessage() throws SOAPException {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
@ -105,6 +106,7 @@ public class MessageFactoryImpl extends MessageFactory {
|
||||
"Unable to parse content type: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public SOAPMessage createMessage(MimeHeaders headers, InputStream in)
|
||||
throws SOAPException, IOException {
|
||||
String contentTypeString = MessageImpl.getContentType(headers);
|
||||
|
@ -87,7 +87,7 @@ public abstract class MessageImpl
|
||||
protected boolean saved = false;
|
||||
protected byte[] messageBytes;
|
||||
protected int messageByteCount;
|
||||
protected HashMap properties = new HashMap();
|
||||
protected Map<String, Object> properties = new HashMap<>();
|
||||
|
||||
// used for lazy attachment initialization
|
||||
protected MimeMultipart multiPart = null;
|
||||
@ -883,17 +883,17 @@ public abstract class MessageImpl
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
if (attachments == null)
|
||||
attachments = new FinalArrayList<AttachmentPart>();
|
||||
attachments = new FinalArrayList<>();
|
||||
|
||||
attachments.add(attachment);
|
||||
|
||||
needsSave();
|
||||
}
|
||||
|
||||
static private final Iterator nullIter = Collections.EMPTY_LIST.iterator();
|
||||
static private final Iterator<AttachmentPart> nullIter = Collections.<AttachmentPart>EMPTY_LIST.iterator();
|
||||
|
||||
@Override
|
||||
public Iterator getAttachments() {
|
||||
public Iterator<AttachmentPart> getAttachments() {
|
||||
try {
|
||||
initializeAllAttachments();
|
||||
} catch (Exception e) {
|
||||
@ -963,7 +963,7 @@ public abstract class MessageImpl
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator getAttachments(MimeHeaders headers) {
|
||||
public Iterator<AttachmentPart> getAttachments(MimeHeaders headers) {
|
||||
try {
|
||||
initializeAllAttachments();
|
||||
} catch (Exception e) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -42,6 +42,7 @@ public class SAAJMetaFactoryImpl extends SAAJMetaFactory {
|
||||
Logger.getLogger(LogDomainConstants.SOAP_DOMAIN,
|
||||
"com.sun.xml.internal.messaging.saaj.soap.LocalStrings");
|
||||
|
||||
@Override
|
||||
protected MessageFactory newMessageFactory(String protocol)
|
||||
throws SOAPException {
|
||||
if (SOAPConstants.SOAP_1_1_PROTOCOL.equals(protocol)) {
|
||||
@ -60,6 +61,7 @@ public class SAAJMetaFactoryImpl extends SAAJMetaFactory {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SOAPFactory newSOAPFactory(String protocol)
|
||||
throws SOAPException {
|
||||
if (SOAPConstants.SOAP_1_1_PROTOCOL.equals(protocol)) {
|
||||
|
@ -0,0 +1,234 @@
|
||||
/*
|
||||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.xml.internal.messaging.saaj.soap;
|
||||
|
||||
import com.sun.xml.internal.messaging.saaj.soap.impl.NodeListImpl;
|
||||
import org.w3c.dom.*;
|
||||
|
||||
/**
|
||||
* SAAJ wrapper for {@link DocumentFragment}
|
||||
*
|
||||
* @author Yan GAO.
|
||||
*/
|
||||
public class SOAPDocumentFragment implements DocumentFragment {
|
||||
|
||||
private SOAPDocumentImpl soapDocument;
|
||||
private DocumentFragment documentFragment;
|
||||
|
||||
public SOAPDocumentFragment(SOAPDocumentImpl ownerDoc) {
|
||||
this.soapDocument = ownerDoc;
|
||||
this.documentFragment = soapDocument.getDomDocument().createDocumentFragment();
|
||||
}
|
||||
|
||||
public SOAPDocumentFragment() {}
|
||||
|
||||
@Override
|
||||
public boolean hasAttributes() {
|
||||
return documentFragment.hasAttributes();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSameNode(Node other) {
|
||||
return documentFragment.isSameNode(getDomNode(other));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String lookupNamespaceURI(String prefix) {
|
||||
return documentFragment.lookupNamespaceURI(prefix);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Node getParentNode() {
|
||||
return soapDocument.findIfPresent(documentFragment.getParentNode());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Node getFirstChild() {
|
||||
return soapDocument.findIfPresent(documentFragment.getFirstChild());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getUserData(String key) {
|
||||
return documentFragment.getUserData(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextContent() throws DOMException {
|
||||
return documentFragment.getTextContent();
|
||||
}
|
||||
@Override
|
||||
public short getNodeType() {
|
||||
return documentFragment.getNodeType();
|
||||
}
|
||||
|
||||
public Node getDomNode(Node node) {
|
||||
return soapDocument.getDomNode(node);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Node appendChild(Node newChild) throws DOMException {
|
||||
Node node = soapDocument.importNode(newChild, true);
|
||||
return soapDocument.findIfPresent(documentFragment.appendChild(getDomNode(node)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Node removeChild(Node oldChild) throws DOMException {
|
||||
return soapDocument.findIfPresent(documentFragment.removeChild(getDomNode(oldChild)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public NamedNodeMap getAttributes() {
|
||||
return documentFragment.getAttributes();
|
||||
}
|
||||
|
||||
@Override
|
||||
public short compareDocumentPosition(Node other) throws DOMException {
|
||||
return documentFragment.compareDocumentPosition(getDomNode(other));
|
||||
}
|
||||
@Override
|
||||
public void setTextContent(String textContent) throws DOMException {
|
||||
documentFragment.setTextContent(textContent);
|
||||
}
|
||||
@Override
|
||||
public Node insertBefore(Node newChild, Node refChild) throws DOMException {
|
||||
Node node = soapDocument.importNode(newChild, true);
|
||||
return soapDocument.findIfPresent(documentFragment.insertBefore(getDomNode(node), getDomNode(refChild)));
|
||||
}
|
||||
@Override
|
||||
public Object setUserData(String key, Object data, UserDataHandler handler) {
|
||||
return documentFragment.setUserData(key, data, handler);
|
||||
}
|
||||
@Override
|
||||
public boolean isDefaultNamespace(String namespaceURI) {
|
||||
return documentFragment.isDefaultNamespace(namespaceURI);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Node getLastChild() {
|
||||
return soapDocument.findIfPresent(documentFragment.getLastChild());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPrefix(String prefix) throws DOMException {
|
||||
documentFragment.setPrefix(prefix);
|
||||
}
|
||||
@Override
|
||||
public String getNodeName() {
|
||||
return documentFragment.getNodeName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setNodeValue(String nodeValue) throws DOMException {
|
||||
documentFragment.setNodeValue(nodeValue);
|
||||
}
|
||||
@Override
|
||||
public Node replaceChild(Node newChild, Node oldChild) throws DOMException {
|
||||
Node node = soapDocument.importNode(newChild, true);
|
||||
return soapDocument.findIfPresent(documentFragment.replaceChild(getDomNode(node), getDomNode(oldChild)));
|
||||
}
|
||||
@Override
|
||||
public String getLocalName() {
|
||||
return documentFragment.getLocalName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void normalize() {
|
||||
documentFragment.normalize();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Node cloneNode(boolean deep) {
|
||||
Node node= documentFragment.cloneNode(deep);
|
||||
soapDocument.registerChildNodes(node, deep);
|
||||
return soapDocument.findIfPresent(node);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSupported(String feature, String version) {
|
||||
return documentFragment.isSupported(feature, version);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEqualNode(Node arg) {
|
||||
return documentFragment.isEqualNode(getDomNode(arg));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasChildNodes() {
|
||||
return documentFragment.hasChildNodes();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String lookupPrefix(String namespaceURI) {
|
||||
return documentFragment.lookupPrefix(namespaceURI);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNodeValue() throws DOMException {
|
||||
return documentFragment.getNodeValue();
|
||||
}
|
||||
@Override
|
||||
public Document getOwnerDocument() {
|
||||
return documentFragment.getOwnerDocument();
|
||||
}
|
||||
@Override
|
||||
public Object getFeature(String feature, String version) {
|
||||
return documentFragment.getFeature(feature, version);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Node getPreviousSibling() {
|
||||
return soapDocument.findIfPresent(documentFragment.getPreviousSibling());
|
||||
}
|
||||
|
||||
@Override
|
||||
public NodeList getChildNodes() {
|
||||
return new NodeListImpl(soapDocument, documentFragment.getChildNodes());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBaseURI() {
|
||||
return documentFragment.getBaseURI();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Node getNextSibling() {
|
||||
return soapDocument.findIfPresent(documentFragment.getNextSibling());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPrefix() {
|
||||
return documentFragment.getPrefix();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNamespaceURI() {
|
||||
return documentFragment.getNamespaceURI();
|
||||
}
|
||||
public Document getSoapDocument() {
|
||||
return soapDocument;
|
||||
}
|
||||
}
|
@ -32,6 +32,8 @@ package com.sun.xml.internal.messaging.saaj.soap;
|
||||
import com.sun.xml.internal.messaging.saaj.soap.impl.CDATAImpl;
|
||||
import com.sun.xml.internal.messaging.saaj.soap.impl.ElementFactory;
|
||||
import com.sun.xml.internal.messaging.saaj.soap.impl.ElementImpl;
|
||||
import com.sun.xml.internal.messaging.saaj.soap.impl.NamedNodeMapImpl;
|
||||
import com.sun.xml.internal.messaging.saaj.soap.impl.NodeListImpl;
|
||||
import com.sun.xml.internal.messaging.saaj.soap.impl.SOAPCommentImpl;
|
||||
import com.sun.xml.internal.messaging.saaj.soap.impl.SOAPTextImpl;
|
||||
import com.sun.xml.internal.messaging.saaj.soap.name.NameImpl;
|
||||
@ -39,6 +41,7 @@ import com.sun.xml.internal.messaging.saaj.util.LogDomainConstants;
|
||||
import com.sun.xml.internal.messaging.saaj.util.SAAJUtil;
|
||||
import org.w3c.dom.Attr;
|
||||
import org.w3c.dom.CDATASection;
|
||||
import org.w3c.dom.CharacterData;
|
||||
import org.w3c.dom.Comment;
|
||||
import org.w3c.dom.DOMConfiguration;
|
||||
import org.w3c.dom.DOMException;
|
||||
@ -52,6 +55,7 @@ import org.w3c.dom.NamedNodeMap;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
import org.w3c.dom.ProcessingInstruction;
|
||||
import org.w3c.dom.Text;
|
||||
import org.w3c.dom.UserDataHandler;
|
||||
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
@ -59,13 +63,14 @@ import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
import javax.xml.soap.SOAPElement;
|
||||
import javax.xml.soap.SOAPException;
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.text.MessageFormat;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
public class SOAPDocumentImpl implements SOAPDocument, javax.xml.soap.Node, Document {
|
||||
|
||||
public static final String SAAJ_NODE = "javax.xml.soap.Node";
|
||||
|
||||
private static final String XMLNS = "xmlns".intern();
|
||||
protected static final Logger log =
|
||||
Logger.getLogger(LogDomainConstants.SOAP_DOMAIN,
|
||||
@ -75,8 +80,6 @@ public class SOAPDocumentImpl implements SOAPDocument, javax.xml.soap.Node, Docu
|
||||
|
||||
private Document document;
|
||||
|
||||
private Map<Node, javax.xml.soap.Node> domToSoap = new HashMap<>();
|
||||
|
||||
public SOAPDocumentImpl(SOAPPartImpl enclosingDocument) {
|
||||
document = createDocument();
|
||||
this.enclosingSOAPPart = enclosingDocument;
|
||||
@ -105,6 +108,7 @@ public class SOAPDocumentImpl implements SOAPDocument, javax.xml.soap.Node, Docu
|
||||
// super(doctype, grammarAccess);
|
||||
// }
|
||||
|
||||
@Override
|
||||
public SOAPPartImpl getSOAPPart() {
|
||||
if (enclosingSOAPPart == null) {
|
||||
log.severe("SAAJ0541.soap.fragment.not.bound.to.part");
|
||||
@ -113,19 +117,23 @@ public class SOAPDocumentImpl implements SOAPDocument, javax.xml.soap.Node, Docu
|
||||
return enclosingSOAPPart;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SOAPDocumentImpl getDocument() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DocumentType getDoctype() {
|
||||
// SOAP means no DTD, No DTD means no doctype (SOAP 1.2 only?)
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DOMImplementation getImplementation() {
|
||||
return document.getImplementation();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Element getDocumentElement() {
|
||||
// This had better be an Envelope!
|
||||
getSOAPPart().doGetDocumentElement();
|
||||
@ -136,6 +144,7 @@ public class SOAPDocumentImpl implements SOAPDocument, javax.xml.soap.Node, Docu
|
||||
return document.getDocumentElement();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Element createElement(String tagName) throws DOMException {
|
||||
return ElementFactory.createElement(
|
||||
this,
|
||||
@ -144,22 +153,27 @@ public class SOAPDocumentImpl implements SOAPDocument, javax.xml.soap.Node, Docu
|
||||
null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DocumentFragment createDocumentFragment() {
|
||||
return document.createDocumentFragment();
|
||||
return new SOAPDocumentFragment(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public org.w3c.dom.Text createTextNode(String data) {
|
||||
return new SOAPTextImpl(this, data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Comment createComment(String data) {
|
||||
return new SOAPCommentImpl(this, data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CDATASection createCDATASection(String data) throws DOMException {
|
||||
return new CDATAImpl(this, data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProcessingInstruction createProcessingInstruction(
|
||||
String target,
|
||||
String data)
|
||||
@ -168,6 +182,7 @@ public class SOAPDocumentImpl implements SOAPDocument, javax.xml.soap.Node, Docu
|
||||
throw new UnsupportedOperationException("Processing Instructions are not allowed in SOAP documents");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Attr createAttribute(String name) throws DOMException {
|
||||
boolean isQualifiedName = (name.indexOf(":") > 0);
|
||||
if (isQualifiedName) {
|
||||
@ -184,24 +199,70 @@ public class SOAPDocumentImpl implements SOAPDocument, javax.xml.soap.Node, Docu
|
||||
return document.createAttribute(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityReference createEntityReference(String name)
|
||||
throws DOMException {
|
||||
log.severe("SAAJ0543.soap.entity.refs.not.allowed.in.docs");
|
||||
throw new UnsupportedOperationException("Entity References are not allowed in SOAP documents");
|
||||
}
|
||||
|
||||
@Override
|
||||
public NodeList getElementsByTagName(String tagname) {
|
||||
return document.getElementsByTagName(tagname);
|
||||
return new NodeListImpl(this, document.getElementsByTagName(tagname));
|
||||
}
|
||||
|
||||
@Override
|
||||
public org.w3c.dom.Node importNode(Node importedNode, boolean deep)
|
||||
throws DOMException {
|
||||
final Node node = document.importNode(getDomNode(importedNode), deep);
|
||||
return node instanceof Element ?
|
||||
ElementFactory.createElement(this, (Element) node)
|
||||
: node;
|
||||
Node domNode = getDomNode(importedNode);
|
||||
final Node newNode = document.importNode(domNode, deep);
|
||||
|
||||
if (importedNode instanceof javax.xml.soap.Node) {
|
||||
Node newSoapNode = createSoapNode(importedNode.getClass(), newNode);
|
||||
newNode.setUserData(SAAJ_NODE, newSoapNode, null);
|
||||
if (deep && importedNode.hasChildNodes()) {
|
||||
NodeList childNodes = importedNode.getChildNodes();
|
||||
for (int i = 0; i < childNodes.getLength(); i++) {
|
||||
registerChildNodes(childNodes.item(i), deep);
|
||||
}
|
||||
}
|
||||
return newSoapNode;
|
||||
}
|
||||
|
||||
registerChildNodes(newNode, deep);
|
||||
return findIfPresent(newNode);
|
||||
}
|
||||
|
||||
//If the parentNode is not registered to domToSoap, create soap wapper for parentNode and register it to domToSoap
|
||||
//If deep = true, also register all children of parentNode to domToSoap map.
|
||||
public void registerChildNodes(Node parentNode, boolean deep) {
|
||||
if (parentNode.getUserData(SAAJ_NODE) == null) {
|
||||
if (parentNode instanceof Element) {
|
||||
ElementFactory.createElement(this, (Element) parentNode);
|
||||
} else if (parentNode instanceof CharacterData) {
|
||||
switch (parentNode.getNodeType()) {
|
||||
case CDATA_SECTION_NODE:
|
||||
new CDATAImpl(this, (CharacterData) parentNode);
|
||||
break;
|
||||
case COMMENT_NODE:
|
||||
new SOAPCommentImpl(this, (CharacterData) parentNode);
|
||||
break;
|
||||
case TEXT_NODE:
|
||||
new SOAPTextImpl(this, (CharacterData) parentNode);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (deep) {
|
||||
NodeList nodeList = parentNode.getChildNodes();
|
||||
for (int i = 0; i < nodeList.getLength(); i++) {
|
||||
Node nextChild = nodeList.item(i);
|
||||
registerChildNodes(nextChild, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Element createElementNS(String namespaceURI, String qualifiedName)
|
||||
throws DOMException {
|
||||
return ElementFactory.createElement(
|
||||
@ -211,19 +272,22 @@ public class SOAPDocumentImpl implements SOAPDocument, javax.xml.soap.Node, Docu
|
||||
namespaceURI);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Attr createAttributeNS(String namespaceURI, String qualifiedName)
|
||||
throws DOMException {
|
||||
return document.createAttributeNS(namespaceURI, qualifiedName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NodeList getElementsByTagNameNS(
|
||||
String namespaceURI,
|
||||
String localName) {
|
||||
return document.getElementsByTagNameNS(namespaceURI, localName);
|
||||
return new NodeListImpl(this, document.getElementsByTagNameNS(namespaceURI, localName));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Element getElementById(String elementId) {
|
||||
return document.getElementById(elementId);
|
||||
return (Element) findIfPresent(document.getElementById(elementId));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -293,7 +357,7 @@ public class SOAPDocumentImpl implements SOAPDocument, javax.xml.soap.Node, Docu
|
||||
|
||||
@Override
|
||||
public Node renameNode(Node n, String namespaceURI, String qualifiedName) throws DOMException {
|
||||
return document.renameNode(n, namespaceURI, qualifiedName);
|
||||
return findIfPresent(document.renameNode(n, namespaceURI, qualifiedName));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -318,37 +382,37 @@ public class SOAPDocumentImpl implements SOAPDocument, javax.xml.soap.Node, Docu
|
||||
|
||||
@Override
|
||||
public Node getParentNode() {
|
||||
return document.getParentNode();
|
||||
return findIfPresent(document.getParentNode());
|
||||
}
|
||||
|
||||
@Override
|
||||
public NodeList getChildNodes() {
|
||||
return document.getChildNodes();
|
||||
return new NodeListImpl(this, document.getChildNodes());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Node getFirstChild() {
|
||||
return document.getFirstChild();
|
||||
return findIfPresent(document.getFirstChild());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Node getLastChild() {
|
||||
return document.getLastChild();
|
||||
return findIfPresent(document.getLastChild());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Node getPreviousSibling() {
|
||||
return document.getPreviousSibling();
|
||||
return findIfPresent(document.getPreviousSibling());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Node getNextSibling() {
|
||||
return document.getNextSibling();
|
||||
return findIfPresent(document.getNextSibling());
|
||||
}
|
||||
|
||||
@Override
|
||||
public NamedNodeMap getAttributes() {
|
||||
return document.getAttributes();
|
||||
return new NamedNodeMapImpl(document.getAttributes(), this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -383,7 +447,9 @@ public class SOAPDocumentImpl implements SOAPDocument, javax.xml.soap.Node, Docu
|
||||
|
||||
@Override
|
||||
public Node cloneNode(boolean deep) {
|
||||
return document.cloneNode(deep);
|
||||
Node node = document.cloneNode(deep);
|
||||
registerChildNodes(node, deep);
|
||||
return findIfPresent(node);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -428,7 +494,7 @@ public class SOAPDocumentImpl implements SOAPDocument, javax.xml.soap.Node, Docu
|
||||
|
||||
@Override
|
||||
public short compareDocumentPosition(Node other) throws DOMException {
|
||||
return document.compareDocumentPosition(other);
|
||||
return document.compareDocumentPosition(getDomNode(other));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -443,7 +509,7 @@ public class SOAPDocumentImpl implements SOAPDocument, javax.xml.soap.Node, Docu
|
||||
|
||||
@Override
|
||||
public boolean isSameNode(Node other) {
|
||||
return document.isSameNode(other);
|
||||
return document.isSameNode(getDomNode(other));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -463,7 +529,7 @@ public class SOAPDocumentImpl implements SOAPDocument, javax.xml.soap.Node, Docu
|
||||
|
||||
@Override
|
||||
public boolean isEqualNode(Node arg) {
|
||||
return document.isEqualNode(arg);
|
||||
return document.isEqualNode(getDomNode(arg));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -496,11 +562,11 @@ public class SOAPDocumentImpl implements SOAPDocument, javax.xml.soap.Node, Docu
|
||||
*/
|
||||
public void register(javax.xml.soap.Node node) {
|
||||
final Node domElement = getDomNode(node);
|
||||
if (domToSoap.containsKey(domElement)) {
|
||||
if (domElement.getUserData(SAAJ_NODE) != null) {
|
||||
throw new IllegalStateException("Element " + domElement.getNodeName()
|
||||
+ " is already registered");
|
||||
}
|
||||
domToSoap.put(domElement, node);
|
||||
domElement.setUserData(SAAJ_NODE, node, null);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -522,7 +588,7 @@ public class SOAPDocumentImpl implements SOAPDocument, javax.xml.soap.Node, Docu
|
||||
if (node instanceof javax.xml.soap.Node) {
|
||||
return (javax.xml.soap.Node) node;
|
||||
}
|
||||
final javax.xml.soap.Node found = domToSoap.get(node);
|
||||
final javax.xml.soap.Node found = (javax.xml.soap.Node) node.getUserData(SAAJ_NODE);
|
||||
if (found == null && required) {
|
||||
throw new IllegalArgumentException(MessageFormat.format("Cannot find SOAP wrapper for element {0}", node));
|
||||
}
|
||||
@ -562,6 +628,24 @@ public class SOAPDocumentImpl implements SOAPDocument, javax.xml.soap.Node, Docu
|
||||
return node;
|
||||
}
|
||||
|
||||
|
||||
private Node createSoapNode(Class nodeType, Node node) {
|
||||
if (SOAPTextImpl.class.isAssignableFrom(nodeType)) {
|
||||
return new SOAPTextImpl(this, (Text) node);
|
||||
} else if (SOAPCommentImpl.class.isAssignableFrom(nodeType)) {
|
||||
return new SOAPCommentImpl(this, (Comment) node);
|
||||
} else if (CDATAImpl.class.isAssignableFrom(nodeType)) {
|
||||
return new CDATAImpl(this, (CDATASection) node);
|
||||
}
|
||||
try {
|
||||
Constructor<Node> constructor = nodeType.getConstructor(SOAPDocumentImpl.class, Element.class);
|
||||
return constructor.newInstance(this, node);
|
||||
} catch (Exception e) {
|
||||
throw new IllegalStateException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public Document getDomElement() {
|
||||
return document;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -49,6 +49,7 @@ public abstract class SOAPFactoryImpl extends SOAPFactory {
|
||||
|
||||
protected abstract SOAPDocumentImpl createDocument();
|
||||
|
||||
@Override
|
||||
public SOAPElement createElement(String tagName) throws SOAPException {
|
||||
if (tagName == null) {
|
||||
log.log(
|
||||
@ -60,6 +61,7 @@ public abstract class SOAPFactoryImpl extends SOAPFactory {
|
||||
NameImpl.createFromTagName(tagName));
|
||||
}
|
||||
|
||||
@Override
|
||||
public SOAPElement createElement(Name name) throws SOAPException {
|
||||
// @since SAAJ 1.3
|
||||
// If the Name was null it would cause a NullPointerException in earlier release
|
||||
@ -71,6 +73,7 @@ public abstract class SOAPFactoryImpl extends SOAPFactory {
|
||||
return ElementFactory.createElement(createDocument(), name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SOAPElement createElement(QName qname) throws SOAPException {
|
||||
if (qname == null) {
|
||||
log.log(Level.SEVERE,"SAAJ0567.soap.null.input",
|
||||
@ -80,6 +83,7 @@ public abstract class SOAPFactoryImpl extends SOAPFactory {
|
||||
return ElementFactory.createElement(createDocument(),qname);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SOAPElement createElement(
|
||||
String localName,
|
||||
String prefix,
|
||||
@ -96,6 +100,7 @@ public abstract class SOAPFactoryImpl extends SOAPFactory {
|
||||
return ElementFactory.createElement(createDocument(), localName, prefix, uri);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Name createName(String localName, String prefix, String uri)
|
||||
throws SOAPException {
|
||||
// @since SAAJ 1.3
|
||||
@ -110,6 +115,7 @@ public abstract class SOAPFactoryImpl extends SOAPFactory {
|
||||
return NameImpl.create(localName, prefix, uri);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Name createName(String localName) throws SOAPException {
|
||||
// @since SAAJ 1.3
|
||||
// if localName==null, earlier impl would create Name with localName=null
|
||||
@ -125,6 +131,7 @@ public abstract class SOAPFactoryImpl extends SOAPFactory {
|
||||
|
||||
// Note: the child elements might still be org.w3c.dom.Element's, but the
|
||||
// getChildElements will do the conversion to SOAPElement when called.
|
||||
@Override
|
||||
public SOAPElement createElement(Element domElement) throws SOAPException {
|
||||
if (domElement == null) {
|
||||
return null;
|
||||
@ -163,14 +170,17 @@ public abstract class SOAPFactoryImpl extends SOAPFactory {
|
||||
return copy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Detail createDetail() throws SOAPException {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public SOAPFault createFault(String reasonText, QName faultCode) throws SOAPException {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public SOAPFault createFault() throws SOAPException {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -64,6 +64,7 @@ public class SOAPIOException extends IOException {
|
||||
soapException.fillInStackTrace();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Throwable fillInStackTrace() {
|
||||
if (soapException != null) {
|
||||
soapException.fillInStackTrace();
|
||||
@ -71,26 +72,32 @@ public class SOAPIOException extends IOException {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLocalizedMessage() {
|
||||
return soapException.getLocalizedMessage();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return soapException.getMessage();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void printStackTrace() {
|
||||
soapException.printStackTrace();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void printStackTrace(PrintStream s) {
|
||||
soapException.printStackTrace(s);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void printStackTrace(PrintWriter s) {
|
||||
soapException.printStackTrace(s);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return soapException.toString();
|
||||
}
|
||||
|
@ -75,6 +75,7 @@ import java.io.UnsupportedEncodingException;
|
||||
import java.util.Iterator;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import javax.xml.soap.MimeHeader;
|
||||
|
||||
/**
|
||||
* SOAPPartImpl is the first attachment. This contains the XML/SOAP document.
|
||||
@ -136,6 +137,7 @@ public abstract class SOAPPartImpl extends SOAPPart implements SOAPDocument {
|
||||
return (message != null) ? message.isFastInfoset() : false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SOAPEnvelope getEnvelope() throws SOAPException {
|
||||
|
||||
// If there is no SOAP envelope already created, then create
|
||||
@ -185,38 +187,47 @@ public abstract class SOAPPartImpl extends SOAPPart implements SOAPDocument {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeAllMimeHeaders() {
|
||||
headers.removeAllHeaders();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeMimeHeader(String header) {
|
||||
headers.removeHeader(header);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getMimeHeader(String name) {
|
||||
return headers.getHeader(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMimeHeader(String name, String value) {
|
||||
headers.setHeader(name, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addMimeHeader(String name, String value) {
|
||||
headers.addHeader(name, value);
|
||||
}
|
||||
|
||||
public Iterator getAllMimeHeaders() {
|
||||
@Override
|
||||
public Iterator<MimeHeader> getAllMimeHeaders() {
|
||||
return headers.getAllHeaders();
|
||||
}
|
||||
|
||||
public Iterator getMatchingMimeHeaders(String[] names) {
|
||||
@Override
|
||||
public Iterator<MimeHeader> getMatchingMimeHeaders(String[] names) {
|
||||
return headers.getMatchingHeaders(names);
|
||||
}
|
||||
|
||||
public Iterator getNonMatchingMimeHeaders(String[] names) {
|
||||
@Override
|
||||
public Iterator<MimeHeader> getNonMatchingMimeHeaders(String[] names) {
|
||||
return headers.getNonMatchingHeaders(names);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Source getContent() throws SOAPException {
|
||||
if (source != null) {
|
||||
InputStream bis = null;
|
||||
@ -248,6 +259,7 @@ public abstract class SOAPPartImpl extends SOAPPart implements SOAPDocument {
|
||||
return ((Envelope) getEnvelope()).getContent();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setContent(Source source) throws SOAPException {
|
||||
try {
|
||||
if (source instanceof StreamSource) {
|
||||
@ -376,18 +388,22 @@ public abstract class SOAPPartImpl extends SOAPPart implements SOAPDocument {
|
||||
|
||||
DataHandler getDataHandler() {
|
||||
DataSource ds = new DataSource() {
|
||||
@Override
|
||||
public OutputStream getOutputStream() throws IOException {
|
||||
throw new IOException("Illegal Operation");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getContentType() {
|
||||
return getContentTypeString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return getContentId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public InputStream getInputStream() throws IOException {
|
||||
return getContentAsStream();
|
||||
}
|
||||
@ -395,15 +411,18 @@ public abstract class SOAPPartImpl extends SOAPPart implements SOAPDocument {
|
||||
return new DataHandler(ds);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SOAPDocumentImpl getDocument() {
|
||||
handleNewSource();
|
||||
return document;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SOAPPartImpl getSOAPPart() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DocumentType getDoctype() {
|
||||
return document.getDoctype();
|
||||
}
|
||||
@ -412,10 +431,12 @@ public abstract class SOAPPartImpl extends SOAPPart implements SOAPDocument {
|
||||
// same way whether they are called from here or directly from the document.
|
||||
// If the document needs any help from this SOAPPart then
|
||||
// Make it use a call-back as in doGetDocumentElement() below
|
||||
@Override
|
||||
public DOMImplementation getImplementation() {
|
||||
return document.getImplementation();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Element getDocumentElement() {
|
||||
// If there is no SOAP envelope already created, then create
|
||||
// one from a source if one exists. If there is a newer source
|
||||
@ -435,26 +456,32 @@ public abstract class SOAPPartImpl extends SOAPPart implements SOAPDocument {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Element createElement(String tagName) throws DOMException {
|
||||
return document.createElement(tagName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DocumentFragment createDocumentFragment() {
|
||||
return document.createDocumentFragment();
|
||||
}
|
||||
|
||||
@Override
|
||||
public org.w3c.dom.Text createTextNode(String data) {
|
||||
return document.createTextNode(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Comment createComment(String data) {
|
||||
return document.createComment(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CDATASection createCDATASection(String data) throws DOMException {
|
||||
return document.createCDATASection(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProcessingInstruction createProcessingInstruction(
|
||||
String target,
|
||||
String data)
|
||||
@ -462,20 +489,24 @@ public abstract class SOAPPartImpl extends SOAPPart implements SOAPDocument {
|
||||
return document.createProcessingInstruction(target, data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Attr createAttribute(String name) throws DOMException {
|
||||
return document.createAttribute(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityReference createEntityReference(String name)
|
||||
throws DOMException {
|
||||
return document.createEntityReference(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NodeList getElementsByTagName(String tagname) {
|
||||
handleNewSource();
|
||||
return document.getElementsByTagName(tagname);
|
||||
}
|
||||
|
||||
@Override
|
||||
public org.w3c.dom.Node importNode(
|
||||
org.w3c.dom.Node importedNode,
|
||||
boolean deep)
|
||||
@ -484,16 +515,19 @@ public abstract class SOAPPartImpl extends SOAPPart implements SOAPDocument {
|
||||
return document.importNode(importedNode, deep);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Element createElementNS(String namespaceURI, String qualifiedName)
|
||||
throws DOMException {
|
||||
return document.createElementNS(namespaceURI, qualifiedName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Attr createAttributeNS(String namespaceURI, String qualifiedName)
|
||||
throws DOMException {
|
||||
return document.createAttributeNS(namespaceURI, qualifiedName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NodeList getElementsByTagNameNS(
|
||||
String namespaceURI,
|
||||
String localName) {
|
||||
@ -501,16 +535,19 @@ public abstract class SOAPPartImpl extends SOAPPart implements SOAPDocument {
|
||||
return document.getElementsByTagNameNS(namespaceURI, localName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Element getElementById(String elementId) {
|
||||
handleNewSource();
|
||||
return document.getElementById(elementId);
|
||||
}
|
||||
@Override
|
||||
public org.w3c.dom.Node appendChild(org.w3c.dom.Node newChild)
|
||||
throws DOMException {
|
||||
handleNewSource();
|
||||
return document.appendChild(newChild);
|
||||
}
|
||||
|
||||
@Override
|
||||
public org.w3c.dom.Node cloneNode(boolean deep) {
|
||||
handleNewSource();
|
||||
return document.cloneNode(deep);
|
||||
@ -525,75 +562,92 @@ public abstract class SOAPPartImpl extends SOAPPart implements SOAPDocument {
|
||||
return newSoapPart;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NamedNodeMap getAttributes() {
|
||||
return document.getDomDocument().getAttributes();
|
||||
}
|
||||
|
||||
@Override
|
||||
public NodeList getChildNodes() {
|
||||
handleNewSource();
|
||||
return document.getChildNodes();
|
||||
}
|
||||
|
||||
@Override
|
||||
public org.w3c.dom.Node getFirstChild() {
|
||||
handleNewSource();
|
||||
return document.getFirstChild();
|
||||
}
|
||||
|
||||
@Override
|
||||
public org.w3c.dom.Node getLastChild() {
|
||||
handleNewSource();
|
||||
return document.getLastChild();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLocalName() {
|
||||
return document.getDomDocument().getLocalName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNamespaceURI() {
|
||||
return document.getDomDocument().getNamespaceURI();
|
||||
}
|
||||
|
||||
@Override
|
||||
public org.w3c.dom.Node getNextSibling() {
|
||||
handleNewSource();
|
||||
return document.getNextSibling();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNodeName() {
|
||||
return document.getDomDocument().getNodeName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public short getNodeType() {
|
||||
return document.getDomDocument().getNodeType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNodeValue() throws DOMException {
|
||||
return document.getNodeValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Document getOwnerDocument() {
|
||||
return document.getDomDocument().getOwnerDocument();
|
||||
}
|
||||
|
||||
@Override
|
||||
public org.w3c.dom.Node getParentNode() {
|
||||
return document.getDomDocument().getParentNode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPrefix() {
|
||||
return document.getDomDocument().getPrefix();
|
||||
}
|
||||
|
||||
@Override
|
||||
public org.w3c.dom.Node getPreviousSibling() {
|
||||
return document.getDomDocument().getPreviousSibling();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasAttributes() {
|
||||
return document.getDomDocument().hasAttributes();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasChildNodes() {
|
||||
handleNewSource();
|
||||
return document.hasChildNodes();
|
||||
}
|
||||
|
||||
@Override
|
||||
public org.w3c.dom.Node insertBefore(
|
||||
org.w3c.dom.Node arg0,
|
||||
org.w3c.dom.Node arg1)
|
||||
@ -602,21 +656,25 @@ public abstract class SOAPPartImpl extends SOAPPart implements SOAPDocument {
|
||||
return document.insertBefore(arg0, arg1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSupported(String arg0, String arg1) {
|
||||
return document.getDomDocument().isSupported(arg0, arg1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void normalize() {
|
||||
handleNewSource();
|
||||
document.normalize();
|
||||
}
|
||||
|
||||
@Override
|
||||
public org.w3c.dom.Node removeChild(org.w3c.dom.Node arg0)
|
||||
throws DOMException {
|
||||
handleNewSource();
|
||||
return document.removeChild(arg0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public org.w3c.dom.Node replaceChild(
|
||||
org.w3c.dom.Node arg0,
|
||||
org.w3c.dom.Node arg1)
|
||||
@ -625,10 +683,12 @@ public abstract class SOAPPartImpl extends SOAPPart implements SOAPDocument {
|
||||
return document.replaceChild(arg0, arg1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setNodeValue(String arg0) throws DOMException {
|
||||
document.setNodeValue(arg0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPrefix(String arg0) throws DOMException {
|
||||
document.setPrefix(arg0);
|
||||
}
|
||||
@ -703,141 +763,173 @@ public abstract class SOAPPartImpl extends SOAPPart implements SOAPDocument {
|
||||
this.sourceCharsetEncoding = charset;
|
||||
}
|
||||
|
||||
@Override
|
||||
public org.w3c.dom.Node renameNode(org.w3c.dom.Node n, String namespaceURI, String qualifiedName)
|
||||
throws DOMException {
|
||||
handleNewSource();
|
||||
return document.renameNode(n, namespaceURI, qualifiedName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void normalizeDocument() {
|
||||
document.normalizeDocument();
|
||||
}
|
||||
|
||||
@Override
|
||||
public DOMConfiguration getDomConfig() {
|
||||
return document.getDomDocument().getDomConfig();
|
||||
}
|
||||
|
||||
@Override
|
||||
public org.w3c.dom.Node adoptNode(org.w3c.dom.Node source) throws DOMException {
|
||||
handleNewSource();
|
||||
return document.adoptNode(source);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDocumentURI(String documentURI) {
|
||||
document.setDocumentURI(documentURI);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDocumentURI() {
|
||||
return document.getDomDocument().getDocumentURI();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setStrictErrorChecking(boolean strictErrorChecking) {
|
||||
document.setStrictErrorChecking(strictErrorChecking);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInputEncoding() {
|
||||
return document.getDomDocument().getInputEncoding();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getXmlEncoding() {
|
||||
return document.getDomDocument().getXmlEncoding();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getXmlStandalone() {
|
||||
return document.getDomDocument().getXmlStandalone();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setXmlStandalone(boolean xmlStandalone) throws DOMException {
|
||||
document.setXmlStandalone(xmlStandalone);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getXmlVersion() {
|
||||
return document.getDomDocument().getXmlVersion();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setXmlVersion(String xmlVersion) throws DOMException {
|
||||
document.setXmlVersion(xmlVersion);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getStrictErrorChecking() {
|
||||
return document.getDomDocument().getStrictErrorChecking();
|
||||
}
|
||||
|
||||
// DOM L3 methods from org.w3c.dom.Node
|
||||
@Override
|
||||
public String getBaseURI() {
|
||||
return document.getDomDocument().getBaseURI();
|
||||
}
|
||||
|
||||
@Override
|
||||
public short compareDocumentPosition(org.w3c.dom.Node other)
|
||||
throws DOMException {
|
||||
return document.compareDocumentPosition(other);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextContent()
|
||||
throws DOMException {
|
||||
return document.getTextContent();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTextContent(String textContent) throws DOMException {
|
||||
document.setTextContent(textContent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSameNode(org.w3c.dom.Node other) {
|
||||
return document.isSameNode(other);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String lookupPrefix(String namespaceURI) {
|
||||
return document.getDomDocument().lookupPrefix(namespaceURI);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDefaultNamespace(String namespaceURI) {
|
||||
return document.isDefaultNamespace(namespaceURI);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String lookupNamespaceURI(String prefix) {
|
||||
return document.lookupNamespaceURI(prefix);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEqualNode(org.w3c.dom.Node arg) {
|
||||
return document.getDomDocument().isEqualNode(arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getFeature(String feature,
|
||||
String version) {
|
||||
return document.getFeature(feature,version);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object setUserData(String key,
|
||||
Object data,
|
||||
UserDataHandler handler) {
|
||||
return document.setUserData(key, data, handler);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getUserData(String key) {
|
||||
return document.getDomDocument().getUserData(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void recycleNode() {
|
||||
// Nothing seems to be required to be done here
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getValue() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValue(String value) {
|
||||
log.severe("SAAJ0571.soappart.setValue.not.defined");
|
||||
throw new IllegalStateException("Setting value of a soap part is not defined");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setParentElement(SOAPElement parent) throws SOAPException {
|
||||
log.severe("SAAJ0570.soappart.parent.element.not.defined");
|
||||
throw new SOAPExceptionImpl("The parent element of a soap part is not defined");
|
||||
}
|
||||
|
||||
@Override
|
||||
public SOAPElement getParentElement() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detachNode() {
|
||||
// Nothing seems to be required to be done here
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -42,38 +42,39 @@ import com.sun.xml.internal.org.jvnet.staxex.util.XMLStreamReaderToXMLStreamWrit
|
||||
* @author shih-chang.chen@oracle.com
|
||||
*/
|
||||
public class StaxLazySourceBridge extends StaxBridge {
|
||||
private LazyEnvelopeSource lazySource;
|
||||
private LazyEnvelopeSource lazySource;
|
||||
|
||||
public StaxLazySourceBridge(LazyEnvelopeSource src, SOAPPartImpl soapPart) throws SOAPException {
|
||||
super(soapPart);
|
||||
lazySource = src;
|
||||
final String soapEnvNS = soapPart.getSOAPNamespace();
|
||||
try {
|
||||
breakpoint = new XMLStreamReaderToXMLStreamWriter.Breakpoint(src.readToBodyStarTag(), saajWriter) {
|
||||
public boolean proceedAfterStartElement() {
|
||||
if ("Body".equals(reader.getLocalName()) && soapEnvNS.equals(reader.getNamespaceURI()) ){
|
||||
return false;
|
||||
} else
|
||||
return true;
|
||||
}
|
||||
};
|
||||
} catch (XMLStreamException e) {
|
||||
throw new SOAPException(e);
|
||||
public StaxLazySourceBridge(LazyEnvelopeSource src, SOAPPartImpl soapPart) throws SOAPException {
|
||||
super(soapPart);
|
||||
lazySource = src;
|
||||
final String soapEnvNS = soapPart.getSOAPNamespace();
|
||||
try {
|
||||
breakpoint = new XMLStreamReaderToXMLStreamWriter.Breakpoint(src.readToBodyStarTag(), saajWriter) {
|
||||
@Override
|
||||
public boolean proceedAfterStartElement() {
|
||||
if ("Body".equals(reader.getLocalName()) && soapEnvNS.equals(reader.getNamespaceURI()) ){
|
||||
return false;
|
||||
} else
|
||||
return true;
|
||||
}
|
||||
};
|
||||
} catch (XMLStreamException e) {
|
||||
throw new SOAPException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Override
|
||||
public XMLStreamReader getPayloadReader() {
|
||||
return lazySource.readPayload();
|
||||
// throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Override
|
||||
public QName getPayloadQName() {
|
||||
return lazySource.getPayloadQName();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Override
|
||||
public String getPayloadAttributeValue(String attName) {
|
||||
if (lazySource.isPayloadStreamReader()) {
|
||||
XMLStreamReader reader = lazySource.readPayload();
|
||||
@ -84,7 +85,7 @@ public class StaxLazySourceBridge extends StaxBridge {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Override
|
||||
public String getPayloadAttributeValue(QName attName) {
|
||||
if (lazySource.isPayloadStreamReader()) {
|
||||
XMLStreamReader reader = lazySource.readPayload();
|
||||
@ -95,12 +96,13 @@ public class StaxLazySourceBridge extends StaxBridge {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void bridgePayload() throws XMLStreamException {
|
||||
//Assuming out is at Body
|
||||
writePayloadTo(saajWriter);
|
||||
}
|
||||
@Override
|
||||
public void bridgePayload() throws XMLStreamException {
|
||||
//Assuming out is at Body
|
||||
writePayloadTo(saajWriter);
|
||||
}
|
||||
|
||||
public void writePayloadTo(XMLStreamWriter writer) throws XMLStreamException {
|
||||
public void writePayloadTo(XMLStreamWriter writer) throws XMLStreamException {
|
||||
lazySource.writePayloadTo(writer);
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -38,41 +38,46 @@ import com.sun.xml.internal.org.jvnet.staxex.util.XMLStreamReaderToXMLStreamWrit
|
||||
* @author shih-chang.chen@oracle.com
|
||||
*/
|
||||
public class StaxReaderBridge extends StaxBridge {
|
||||
private XMLStreamReader in;
|
||||
private XMLStreamReader in;
|
||||
|
||||
public StaxReaderBridge(XMLStreamReader reader, SOAPPartImpl soapPart) throws SOAPException {
|
||||
super(soapPart);
|
||||
in = reader;
|
||||
final String soapEnvNS = soapPart.getSOAPNamespace();
|
||||
breakpoint = new XMLStreamReaderToXMLStreamWriter.Breakpoint(reader, saajWriter) {
|
||||
boolean seenBody = false;
|
||||
boolean stopedAtBody = false;
|
||||
public boolean proceedBeforeStartElement() {
|
||||
if (stopedAtBody) return true;
|
||||
if (seenBody) {
|
||||
stopedAtBody = true;
|
||||
return false;
|
||||
}
|
||||
if ("Body".equals(reader.getLocalName()) && soapEnvNS.equals(reader.getNamespaceURI()) ){
|
||||
seenBody = true;
|
||||
}
|
||||
return true;
|
||||
public StaxReaderBridge(XMLStreamReader reader, SOAPPartImpl soapPart) throws SOAPException {
|
||||
super(soapPart);
|
||||
in = reader;
|
||||
final String soapEnvNS = soapPart.getSOAPNamespace();
|
||||
breakpoint = new XMLStreamReaderToXMLStreamWriter.Breakpoint(reader, saajWriter) {
|
||||
boolean seenBody = false;
|
||||
boolean stopedAtBody = false;
|
||||
@Override
|
||||
public boolean proceedBeforeStartElement() {
|
||||
if (stopedAtBody) return true;
|
||||
if (seenBody) {
|
||||
stopedAtBody = true;
|
||||
return false;
|
||||
}
|
||||
};
|
||||
}
|
||||
if ("Body".equals(reader.getLocalName()) && soapEnvNS.equals(reader.getNamespaceURI()) ){
|
||||
seenBody = true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public XMLStreamReader getPayloadReader() {
|
||||
return in;
|
||||
}
|
||||
|
||||
@Override
|
||||
public QName getPayloadQName() {
|
||||
return (in.getEventType() == XMLStreamConstants.START_ELEMENT) ? in.getName() : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPayloadAttributeValue(String attName) {
|
||||
return (in.getEventType() == XMLStreamConstants.START_ELEMENT) ? in.getAttributeValue(null, attName) : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPayloadAttributeValue(QName attName) {
|
||||
return (in.getEventType() == XMLStreamConstants.START_ELEMENT) ? in.getAttributeValue(attName.getNamespaceURI(), attName.getLocalPart()) : null;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -36,10 +36,12 @@ import com.sun.xml.internal.messaging.saaj.soap.SOAPDocumentImpl;
|
||||
import com.sun.xml.internal.messaging.saaj.soap.SOAPFactoryImpl;
|
||||
|
||||
public class SOAPFactoryDynamicImpl extends SOAPFactoryImpl {
|
||||
@Override
|
||||
protected SOAPDocumentImpl createDocument() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Detail createDetail() throws SOAPException {
|
||||
throw new UnsupportedOperationException(
|
||||
"createDetail() not supported for Dynamic Protocol");
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -35,6 +35,7 @@ import javax.xml.soap.*;
|
||||
import com.sun.xml.internal.messaging.saaj.soap.MessageFactoryImpl;
|
||||
|
||||
public class SOAPMessageFactoryDynamicImpl extends MessageFactoryImpl {
|
||||
@Override
|
||||
public SOAPMessage createMessage() throws SOAPException {
|
||||
throw new UnsupportedOperationException(
|
||||
"createMessage() not supported for Dynamic Protocol");
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -29,6 +29,7 @@ import javax.xml.namespace.QName;
|
||||
import javax.xml.soap.*;
|
||||
|
||||
import com.sun.xml.internal.messaging.saaj.soap.SOAPDocumentImpl;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
/**
|
||||
* All elements of the SOAP-ENV:BODY.
|
||||
@ -47,6 +48,11 @@ public abstract class BodyElementImpl
|
||||
super(ownerDoc, qname);
|
||||
}
|
||||
|
||||
public BodyElementImpl(SOAPDocumentImpl ownerDoc, Element domElement) {
|
||||
super(ownerDoc, domElement);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setParentElement(SOAPElement element) throws SOAPException {
|
||||
if (! (element instanceof SOAPBody)) {
|
||||
log.severe("SAAJ0101.impl.parent.of.body.elem.mustbe.body");
|
||||
|
@ -30,21 +30,30 @@ import java.util.Locale;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import javax.xml.namespace.QName;
|
||||
import javax.xml.soap.*;
|
||||
import javax.xml.stream.XMLStreamException;
|
||||
import javax.xml.stream.XMLStreamReader;
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
|
||||
import com.sun.xml.internal.messaging.saaj.util.SAAJUtil;
|
||||
import org.w3c.dom.*;
|
||||
import org.w3c.dom.Node;
|
||||
|
||||
import com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl;
|
||||
import com.sun.xml.internal.messaging.saaj.soap.SOAPDocument;
|
||||
import com.sun.xml.internal.messaging.saaj.soap.SOAPDocumentImpl;
|
||||
import com.sun.xml.internal.messaging.saaj.soap.StaxBridge;
|
||||
import com.sun.xml.internal.messaging.saaj.soap.name.NameImpl;
|
||||
import javax.xml.soap.Name;
|
||||
import javax.xml.soap.SOAPBody;
|
||||
import javax.xml.soap.SOAPBodyElement;
|
||||
import javax.xml.soap.SOAPElement;
|
||||
import javax.xml.soap.SOAPEnvelope;
|
||||
import javax.xml.soap.SOAPException;
|
||||
import javax.xml.soap.SOAPFault;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.DocumentFragment;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
|
||||
/**
|
||||
* The implementation of SOAP-ENV:BODY or the SOAPBody abstraction.
|
||||
@ -72,6 +81,7 @@ public abstract class BodyImpl extends ElementImpl implements SOAPBody {
|
||||
protected abstract SOAPFault createFaultElement();
|
||||
protected abstract QName getDefaultFaultCode();
|
||||
|
||||
@Override
|
||||
public SOAPFault addFault() throws SOAPException {
|
||||
if (hasFault()) {
|
||||
log.severe("SAAJ0110.impl.fault.already.exists");
|
||||
@ -88,6 +98,7 @@ public abstract class BodyImpl extends ElementImpl implements SOAPBody {
|
||||
return fault;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SOAPFault addFault(
|
||||
Name faultCode,
|
||||
String faultString,
|
||||
@ -100,6 +111,7 @@ public abstract class BodyImpl extends ElementImpl implements SOAPBody {
|
||||
return fault;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SOAPFault addFault(
|
||||
QName faultCode,
|
||||
String faultString,
|
||||
@ -112,6 +124,7 @@ public abstract class BodyImpl extends ElementImpl implements SOAPBody {
|
||||
return fault;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SOAPFault addFault(Name faultCode, String faultString)
|
||||
throws SOAPException {
|
||||
|
||||
@ -121,6 +134,7 @@ public abstract class BodyImpl extends ElementImpl implements SOAPBody {
|
||||
return fault;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SOAPFault addFault(QName faultCode, String faultString)
|
||||
throws SOAPException {
|
||||
|
||||
@ -147,6 +161,7 @@ public abstract class BodyImpl extends ElementImpl implements SOAPBody {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasFault() {
|
||||
QName payloadQName = getPayloadQName();
|
||||
return getFaultQName().equals(payloadQName);
|
||||
@ -156,6 +171,7 @@ public abstract class BodyImpl extends ElementImpl implements SOAPBody {
|
||||
return new QName(getNamespaceURI(), "Fault");
|
||||
}
|
||||
|
||||
@Override
|
||||
public SOAPFault getFault() {
|
||||
if (hasFault()) {
|
||||
if (fault == null) {
|
||||
@ -167,6 +183,7 @@ public abstract class BodyImpl extends ElementImpl implements SOAPBody {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SOAPBodyElement addBodyElement(Name name) throws SOAPException {
|
||||
SOAPBodyElement newBodyElement =
|
||||
(SOAPBodyElement) ElementFactory.createNamedElement(
|
||||
@ -181,6 +198,7 @@ public abstract class BodyImpl extends ElementImpl implements SOAPBody {
|
||||
return newBodyElement;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SOAPBodyElement addBodyElement(QName qname) throws SOAPException {
|
||||
SOAPBodyElement newBodyElement =
|
||||
(SOAPBodyElement) ElementFactory.createNamedElement(
|
||||
@ -195,6 +213,7 @@ public abstract class BodyImpl extends ElementImpl implements SOAPBody {
|
||||
return newBodyElement;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setParentElement(SOAPElement element) throws SOAPException {
|
||||
|
||||
if (!(element instanceof SOAPEnvelope)) {
|
||||
@ -204,10 +223,12 @@ public abstract class BodyImpl extends ElementImpl implements SOAPBody {
|
||||
super.setParentElement(element);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SOAPElement addElement(Name name) throws SOAPException {
|
||||
return addBodyElement(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SOAPElement addElement(QName name) throws SOAPException {
|
||||
return addBodyElement(name);
|
||||
}
|
||||
@ -226,6 +247,7 @@ public abstract class BodyImpl extends ElementImpl implements SOAPBody {
|
||||
// return super.replaceChild(newElement, ref);
|
||||
// }
|
||||
|
||||
@Override
|
||||
public SOAPBodyElement addDocument(Document document)
|
||||
throws SOAPException {
|
||||
/*
|
||||
@ -252,7 +274,7 @@ public abstract class BodyImpl extends ElementImpl implements SOAPBody {
|
||||
org.w3c.dom.Node replacingNode = ownerDoc.importNode(docFrag, true);
|
||||
// Adding replacingNode at the last of the children list of body
|
||||
addNode(replacingNode);
|
||||
Iterator<Node> i =
|
||||
Iterator<javax.xml.soap.Node> i =
|
||||
getChildElements(NameImpl.copyElementName(rootElement));
|
||||
// Return the child element with the required name which is at the
|
||||
// end of the list
|
||||
@ -263,6 +285,7 @@ public abstract class BodyImpl extends ElementImpl implements SOAPBody {
|
||||
//*/
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SOAPElement convertToSoapElement(Element element) {
|
||||
final Node soapNode = getSoapDocument().findIfPresent(element);
|
||||
if ((soapNode instanceof SOAPBodyElement) &&
|
||||
@ -278,6 +301,7 @@ public abstract class BodyImpl extends ElementImpl implements SOAPBody {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public SOAPElement setElementQName(QName newName) throws SOAPException {
|
||||
log.log(Level.SEVERE,
|
||||
"SAAJ0146.impl.invalid.name.change.requested",
|
||||
@ -288,9 +312,10 @@ public abstract class BodyImpl extends ElementImpl implements SOAPBody {
|
||||
+ newName.getLocalPart());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Document extractContentAsDocument() throws SOAPException {
|
||||
|
||||
Iterator<Node> eachChild = getChildElements();
|
||||
Iterator<javax.xml.soap.Node> eachChild = getChildElements();
|
||||
javax.xml.soap.Node firstBodyElement = null;
|
||||
|
||||
while (eachChild.hasNext() &&
|
||||
|
@ -25,325 +25,61 @@
|
||||
|
||||
package com.sun.xml.internal.messaging.saaj.soap.impl;
|
||||
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import javax.xml.soap.SOAPElement;
|
||||
import javax.xml.soap.SOAPException;
|
||||
|
||||
import com.sun.xml.internal.messaging.saaj.soap.SOAPDocumentImpl;
|
||||
import com.sun.xml.internal.messaging.saaj.util.LogDomainConstants;
|
||||
import com.sun.xml.internal.messaging.saaj.util.SAAJUtil;
|
||||
import org.w3c.dom.CDATASection;
|
||||
import org.w3c.dom.CharacterData;
|
||||
import org.w3c.dom.DOMException;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.NamedNodeMap;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
import org.w3c.dom.Text;
|
||||
import org.w3c.dom.UserDataHandler;
|
||||
|
||||
public class CDATAImpl implements CDATASection, javax.xml.soap.Text {
|
||||
|
||||
protected static final Logger log =
|
||||
Logger.getLogger(LogDomainConstants.SOAP_IMPL_DOMAIN,
|
||||
"com.sun.xml.internal.messaging.saaj.soap.impl.LocalStrings");
|
||||
public class CDATAImpl extends TextImpl<CDATASection> implements CDATASection {
|
||||
|
||||
static final String cdataUC = "<![CDATA[";
|
||||
static final String cdataLC = "<![cdata[";
|
||||
|
||||
public CDATAImpl(SOAPDocumentImpl ownerDoc, String text) {
|
||||
super(ownerDoc, text);
|
||||
}
|
||||
|
||||
public CDATAImpl(SOAPDocumentImpl ownerDoc, CharacterData data) {
|
||||
super(ownerDoc, data);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CDATASection createN(SOAPDocumentImpl ownerDoc, String text) {
|
||||
CDATASection c = ownerDoc.getDomDocument().createCDATASection(text);
|
||||
// ownerDoc.register(this);
|
||||
return c;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CDATASection createN(SOAPDocumentImpl ownerDoc, CharacterData data) {
|
||||
CDATASection c = (CDATASection) data;
|
||||
return c;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Text splitText(int offset) throws DOMException {
|
||||
return cdataSection.splitText(offset);
|
||||
return getDomElement().splitText(offset);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isElementContentWhitespace() {
|
||||
return cdataSection.isElementContentWhitespace();
|
||||
return getDomElement().isElementContentWhitespace();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getWholeText() {
|
||||
return cdataSection.getWholeText();
|
||||
return getDomElement().getWholeText();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Text replaceWholeText(String content) throws DOMException {
|
||||
return cdataSection.replaceWholeText(content);
|
||||
return getDomElement().replaceWholeText(content);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getData() throws DOMException {
|
||||
return cdataSection.getData();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setData(String data) throws DOMException {
|
||||
cdataSection.setData(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLength() {
|
||||
return cdataSection.getLength();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String substringData(int offset, int count) throws DOMException {
|
||||
return cdataSection.substringData(offset, count);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void appendData(String arg) throws DOMException {
|
||||
cdataSection.appendData(arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void insertData(int offset, String arg) throws DOMException {
|
||||
cdataSection.insertData(offset, arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteData(int offset, int count) throws DOMException {
|
||||
cdataSection.deleteData(offset, count);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void replaceData(int offset, int count, String arg) throws DOMException {
|
||||
cdataSection.replaceData(offset, count, arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNodeName() {
|
||||
return cdataSection.getNodeName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNodeValue() throws DOMException {
|
||||
return cdataSection.getNodeValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setNodeValue(String nodeValue) throws DOMException {
|
||||
cdataSection.setNodeValue(nodeValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public short getNodeType() {
|
||||
return cdataSection.getNodeType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Node getParentNode() {
|
||||
return cdataSection.getParentNode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public NodeList getChildNodes() {
|
||||
return cdataSection.getChildNodes();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Node getFirstChild() {
|
||||
return cdataSection.getFirstChild();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Node getLastChild() {
|
||||
return cdataSection.getLastChild();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Node getPreviousSibling() {
|
||||
return cdataSection.getPreviousSibling();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Node getNextSibling() {
|
||||
return cdataSection.getNextSibling();
|
||||
}
|
||||
|
||||
@Override
|
||||
public NamedNodeMap getAttributes() {
|
||||
return cdataSection.getAttributes();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Document getOwnerDocument() {
|
||||
return cdataSection.getOwnerDocument();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Node insertBefore(Node newChild, Node refChild) throws DOMException {
|
||||
return cdataSection.insertBefore(newChild, refChild);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Node replaceChild(Node newChild, Node oldChild) throws DOMException {
|
||||
return cdataSection.replaceChild(newChild, oldChild);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Node removeChild(Node oldChild) throws DOMException {
|
||||
return cdataSection.removeChild(oldChild);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Node appendChild(Node newChild) throws DOMException {
|
||||
return cdataSection.appendChild(newChild);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasChildNodes() {
|
||||
return cdataSection.hasChildNodes();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Node cloneNode(boolean deep) {
|
||||
return cdataSection.cloneNode(deep);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void normalize() {
|
||||
cdataSection.normalize();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSupported(String feature, String version) {
|
||||
return cdataSection.isSupported(feature, version);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNamespaceURI() {
|
||||
return cdataSection.getNamespaceURI();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPrefix() {
|
||||
return cdataSection.getPrefix();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPrefix(String prefix) throws DOMException {
|
||||
cdataSection.setPrefix(prefix);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLocalName() {
|
||||
return cdataSection.getLocalName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasAttributes() {
|
||||
return cdataSection.hasAttributes();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBaseURI() {
|
||||
return cdataSection.getBaseURI();
|
||||
}
|
||||
|
||||
@Override
|
||||
public short compareDocumentPosition(Node other) throws DOMException {
|
||||
return cdataSection.compareDocumentPosition(other);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextContent() throws DOMException {
|
||||
return cdataSection.getTextContent();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTextContent(String textContent) throws DOMException {
|
||||
cdataSection.setTextContent(textContent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSameNode(Node other) {
|
||||
return cdataSection.isSameNode(other);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String lookupPrefix(String namespaceURI) {
|
||||
return cdataSection.lookupPrefix(namespaceURI);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDefaultNamespace(String namespaceURI) {
|
||||
return cdataSection.isDefaultNamespace(namespaceURI);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String lookupNamespaceURI(String prefix) {
|
||||
return cdataSection.lookupNamespaceURI(prefix);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEqualNode(Node arg) {
|
||||
return cdataSection.isEqualNode(arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getFeature(String feature, String version) {
|
||||
return cdataSection.getFeature(feature, version);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object setUserData(String key, Object data, UserDataHandler handler) {
|
||||
return cdataSection.setUserData(key, data, handler);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getUserData(String key) {
|
||||
return cdataSection.getUserData(key);
|
||||
}
|
||||
|
||||
private CDATASection cdataSection;
|
||||
|
||||
public CDATAImpl(SOAPDocumentImpl ownerDoc, String text) {
|
||||
cdataSection = ownerDoc.getDomDocument().createCDATASection(text);
|
||||
ownerDoc.register(this);
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
String nodeValue = getNodeValue();
|
||||
return (nodeValue.equals("") ? null : nodeValue);
|
||||
}
|
||||
|
||||
public void setValue(String text) {
|
||||
setNodeValue(text);
|
||||
}
|
||||
|
||||
public void setParentElement(SOAPElement parent) throws SOAPException {
|
||||
if (parent == null) {
|
||||
log.severe("SAAJ0145.impl.no.null.to.parent.elem");
|
||||
throw new SOAPException("Cannot pass NULL to setParentElement");
|
||||
}
|
||||
((ElementImpl) parent).addNode(this);
|
||||
}
|
||||
|
||||
public SOAPElement getParentElement() {
|
||||
return (SOAPElement) getParentNode();
|
||||
}
|
||||
|
||||
|
||||
public void detachNode() {
|
||||
org.w3c.dom.Node parent = getParentNode();
|
||||
if (parent != null) {
|
||||
parent.removeChild(this);
|
||||
}
|
||||
}
|
||||
|
||||
public void recycleNode() {
|
||||
detachNode();
|
||||
// TBD
|
||||
// - add this to the factory so subsequent
|
||||
// creations can reuse this object.
|
||||
}
|
||||
|
||||
public boolean isComment() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public CDATASection getDomElement() {
|
||||
return cdataSection;
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -30,6 +30,7 @@ import javax.xml.soap.DetailEntry;
|
||||
import javax.xml.soap.Name;
|
||||
|
||||
import com.sun.xml.internal.messaging.saaj.soap.SOAPDocumentImpl;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
public abstract class DetailEntryImpl
|
||||
extends ElementImpl
|
||||
@ -40,4 +41,8 @@ public abstract class DetailEntryImpl
|
||||
public DetailEntryImpl(SOAPDocumentImpl ownerDoc, QName qname) {
|
||||
super(ownerDoc, qname);
|
||||
}
|
||||
|
||||
public DetailEntryImpl(SOAPDocumentImpl ownerDoc, Element domElement) {
|
||||
super(ownerDoc, domElement);
|
||||
}
|
||||
}
|
||||
|
@ -31,7 +31,6 @@ import java.util.NoSuchElementException;
|
||||
import javax.xml.namespace.QName;
|
||||
import javax.xml.soap.*;
|
||||
|
||||
import com.sun.xml.internal.messaging.saaj.util.SAAJUtil;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
import com.sun.xml.internal.messaging.saaj.soap.SOAPDocumentImpl;
|
||||
@ -49,26 +48,31 @@ public abstract class DetailImpl extends FaultElementImpl implements Detail {
|
||||
protected abstract DetailEntry createDetailEntry(Name name);
|
||||
protected abstract DetailEntry createDetailEntry(QName name);
|
||||
|
||||
@Override
|
||||
public DetailEntry addDetailEntry(Name name) throws SOAPException {
|
||||
DetailEntry entry = createDetailEntry(name);
|
||||
addNode(entry);
|
||||
return entry;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DetailEntry addDetailEntry(QName qname) throws SOAPException {
|
||||
DetailEntry entry = createDetailEntry(qname);
|
||||
addNode(entry);
|
||||
return entry;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SOAPElement addElement(Name name) throws SOAPException {
|
||||
return addDetailEntry(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SOAPElement addElement(QName name) throws SOAPException {
|
||||
return addDetailEntry(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SOAPElement convertToSoapElement(Element element) {
|
||||
final javax.xml.soap.Node soapNode = getSoapDocument().find(element);
|
||||
if (soapNode instanceof DetailEntry) {
|
||||
@ -82,12 +86,14 @@ public abstract class DetailImpl extends FaultElementImpl implements Detail {
|
||||
}
|
||||
}
|
||||
|
||||
public Iterator getDetailEntries() {
|
||||
return new Iterator<SOAPElement>() {
|
||||
@Override
|
||||
public Iterator<DetailEntry> getDetailEntries() {
|
||||
return new Iterator<DetailEntry>() {
|
||||
Iterator<org.w3c.dom.Node> eachNode = getChildElementNodes();
|
||||
SOAPElement next = null;
|
||||
SOAPElement last = null;
|
||||
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
if (next == null) {
|
||||
while (eachNode.hasNext()) {
|
||||
@ -101,15 +107,17 @@ public abstract class DetailImpl extends FaultElementImpl implements Detail {
|
||||
return next != null;
|
||||
}
|
||||
|
||||
public SOAPElement next() {
|
||||
@Override
|
||||
public DetailEntry next() {
|
||||
if (!hasNext()) {
|
||||
throw new NoSuchElementException();
|
||||
}
|
||||
last = next;
|
||||
next = null;
|
||||
return last;
|
||||
return (DetailEntry) last;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
if (last == null) {
|
||||
throw new IllegalStateException();
|
||||
@ -121,6 +129,7 @@ public abstract class DetailImpl extends FaultElementImpl implements Detail {
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isStandardFaultElement() {
|
||||
return true;
|
||||
}
|
||||
|
@ -106,9 +106,9 @@ public class ElementFactory {
|
||||
}
|
||||
if ("Fault".equalsIgnoreCase(localName)) {
|
||||
if (NameImpl.SOAP11_NAMESPACE.equals(namespaceUri)) {
|
||||
return new Fault1_1Impl(element, ownerDocument);
|
||||
return new Fault1_1Impl(ownerDocument, element);
|
||||
} else if (NameImpl.SOAP12_NAMESPACE.equals(namespaceUri)) {
|
||||
return new Fault1_2Impl(element, ownerDocument);
|
||||
return new Fault1_2Impl(ownerDocument, element);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -27,21 +27,37 @@ package com.sun.xml.internal.messaging.saaj.soap.impl;
|
||||
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.util.*;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import javax.xml.namespace.QName;
|
||||
import javax.xml.soap.*;
|
||||
|
||||
import org.w3c.dom.*;
|
||||
import org.w3c.dom.Node;
|
||||
|
||||
import com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl;
|
||||
import com.sun.xml.internal.messaging.saaj.soap.SOAPDocument;
|
||||
import com.sun.xml.internal.messaging.saaj.soap.SOAPDocumentImpl;
|
||||
import com.sun.xml.internal.messaging.saaj.soap.name.NameImpl;
|
||||
import com.sun.xml.internal.messaging.saaj.util.*;
|
||||
import com.sun.xml.internal.messaging.saaj.util.LogDomainConstants;
|
||||
import com.sun.xml.internal.messaging.saaj.util.NamespaceContextIterator;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.NoSuchElementException;
|
||||
import javax.xml.soap.Name;
|
||||
import javax.xml.soap.SOAPBodyElement;
|
||||
import javax.xml.soap.SOAPConstants;
|
||||
import javax.xml.soap.SOAPElement;
|
||||
import javax.xml.soap.SOAPException;
|
||||
import org.w3c.dom.Attr;
|
||||
import org.w3c.dom.CharacterData;
|
||||
import org.w3c.dom.DOMException;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.DocumentFragment;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.NamedNodeMap;
|
||||
import org.w3c.dom.NodeList;
|
||||
import org.w3c.dom.TypeInfo;
|
||||
import org.w3c.dom.UserDataHandler;
|
||||
|
||||
public class ElementImpl implements SOAPElement, SOAPBodyElement {
|
||||
|
||||
@ -108,7 +124,7 @@ public class ElementImpl implements SOAPElement, SOAPBodyElement {
|
||||
|
||||
@Override
|
||||
public NodeList getElementsByTagName(String name) {
|
||||
return new NodeListImpl(getSoapDocument(), element.getElementsByTagName(name));
|
||||
return new NodeListImpl(soapDocument, element.getElementsByTagName(name));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -139,21 +155,21 @@ public class ElementImpl implements SOAPElement, SOAPBodyElement {
|
||||
this.soapDocument = ownerDoc;
|
||||
this.element = ownerDoc.getDomDocument().createElementNS(name.getURI(), name.getQualifiedName());
|
||||
elementQName = NameImpl.convertToQName(name);
|
||||
getSoapDocument().register(this);
|
||||
soapDocument.register(this);
|
||||
}
|
||||
|
||||
public ElementImpl(SOAPDocumentImpl ownerDoc, QName name) {
|
||||
this.soapDocument = ownerDoc;
|
||||
this.element = ownerDoc.getDomDocument().createElementNS(name.getNamespaceURI(), getQualifiedName(name));
|
||||
elementQName = name;
|
||||
getSoapDocument().register(this);
|
||||
soapDocument.register(this);
|
||||
}
|
||||
|
||||
public ElementImpl(SOAPDocumentImpl ownerDoc, Element domElement) {
|
||||
this.element = domElement;
|
||||
this.soapDocument = ownerDoc;
|
||||
this.elementQName = new QName(domElement.getNamespaceURI(), domElement.getLocalName());
|
||||
getSoapDocument().register(this);
|
||||
soapDocument.register(this);
|
||||
}
|
||||
|
||||
public ElementImpl(
|
||||
@ -165,7 +181,7 @@ public class ElementImpl implements SOAPElement, SOAPBodyElement {
|
||||
this.element = ownerDoc.getDomDocument().createElementNS(uri, qualifiedName);
|
||||
elementQName =
|
||||
new QName(uri, getLocalPart(qualifiedName), getPrefix(qualifiedName));
|
||||
getSoapDocument().register(this);
|
||||
soapDocument.register(this);
|
||||
}
|
||||
|
||||
public void ensureNamespaceIsDeclared(String prefix, String uri) {
|
||||
@ -178,28 +194,29 @@ public class ElementImpl implements SOAPElement, SOAPBodyElement {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Document getOwnerDocument() {
|
||||
return soapDocument;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Node insertBefore(Node newChild, Node refChild) throws DOMException {
|
||||
return element.insertBefore(getSoapDocument().getDomNode(newChild), getSoapDocument().getDomNode(refChild));
|
||||
return soapDocument.findIfPresent(element.insertBefore(soapDocument.getDomNode(newChild), soapDocument.getDomNode(refChild)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Node replaceChild(Node newChild, Node oldChild) throws DOMException {
|
||||
return element.replaceChild(getSoapDocument().getDomNode(newChild), getSoapDocument().getDomNode(oldChild));
|
||||
return soapDocument.findIfPresent(element.replaceChild(soapDocument.getDomNode(newChild), soapDocument.getDomNode(oldChild)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Node removeChild(Node oldChild) throws DOMException {
|
||||
return element.removeChild(getSoapDocument().getDomNode(oldChild));
|
||||
return soapDocument.findIfPresent(element.removeChild(soapDocument.getDomNode(oldChild)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Node appendChild(Node newChild) throws DOMException {
|
||||
return element.appendChild(getSoapDocument().getDomNode(newChild));
|
||||
return soapDocument.findIfPresent(element.appendChild(soapDocument.getDomNode(newChild)));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -209,7 +226,9 @@ public class ElementImpl implements SOAPElement, SOAPBodyElement {
|
||||
|
||||
@Override
|
||||
public Node cloneNode(boolean deep) {
|
||||
return element.cloneNode(deep);
|
||||
Node elementNSNode = element.cloneNode(deep);
|
||||
soapDocument.registerChildNodes(elementNSNode, deep);
|
||||
return soapDocument.findIfPresent(soapDocument.getDomNode(elementNSNode));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -254,7 +273,7 @@ public class ElementImpl implements SOAPElement, SOAPBodyElement {
|
||||
|
||||
@Override
|
||||
public short compareDocumentPosition(Node other) throws DOMException {
|
||||
return element.compareDocumentPosition(other);
|
||||
return element.compareDocumentPosition(soapDocument.getDomNode(other));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -269,7 +288,7 @@ public class ElementImpl implements SOAPElement, SOAPBodyElement {
|
||||
|
||||
@Override
|
||||
public boolean isSameNode(Node other) {
|
||||
return element.isSameNode(other);
|
||||
return element.isSameNode(soapDocument.getDomNode(other));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -289,7 +308,7 @@ public class ElementImpl implements SOAPElement, SOAPBodyElement {
|
||||
|
||||
@Override
|
||||
public boolean isEqualNode(Node arg) {
|
||||
return element.isEqualNode(arg);
|
||||
return element.isEqualNode(soapDocument.getDomNode(arg));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -307,14 +326,17 @@ public class ElementImpl implements SOAPElement, SOAPBodyElement {
|
||||
return element.getUserData(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SOAPElement addChildElement(Name name) throws SOAPException {
|
||||
return addElement(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SOAPElement addChildElement(QName qname) throws SOAPException {
|
||||
return addElement(qname);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SOAPElement addChildElement(String localName) throws SOAPException {
|
||||
String nsUri = getNamespaceURI("");
|
||||
Name name = (nsUri == null || nsUri.isEmpty())
|
||||
@ -323,6 +345,7 @@ public class ElementImpl implements SOAPElement, SOAPBodyElement {
|
||||
return addChildElement(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SOAPElement addChildElement(String localName, String prefix)
|
||||
throws SOAPException {
|
||||
String uri = getNamespaceURI(prefix);
|
||||
@ -337,6 +360,7 @@ public class ElementImpl implements SOAPElement, SOAPBodyElement {
|
||||
return addChildElement(localName, prefix, uri);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNamespaceURI(String prefix) {
|
||||
|
||||
if ("xmlns".equals(prefix)) {
|
||||
@ -415,12 +439,14 @@ public class ElementImpl implements SOAPElement, SOAPBodyElement {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SOAPElement setElementQName(QName newName) throws SOAPException {
|
||||
ElementImpl copy =
|
||||
new ElementImpl((SOAPDocumentImpl) getOwnerDocument(), newName);
|
||||
return replaceElementWithSOAPElement(this,copy);
|
||||
}
|
||||
|
||||
@Override
|
||||
public QName createQName(String localName, String prefix)
|
||||
throws SOAPException {
|
||||
String uri = getNamespaceURI(prefix);
|
||||
@ -485,6 +511,7 @@ public class ElementImpl implements SOAPElement, SOAPBodyElement {
|
||||
return new NamespaceContextIterator(this, traverseStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SOAPElement addChildElement(
|
||||
String localName,
|
||||
String prefix,
|
||||
@ -496,6 +523,7 @@ public class ElementImpl implements SOAPElement, SOAPBodyElement {
|
||||
return convertToSoapElement(newElement);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SOAPElement addChildElement(SOAPElement element)
|
||||
throws SOAPException {
|
||||
|
||||
@ -531,7 +559,7 @@ public class ElementImpl implements SOAPElement, SOAPBodyElement {
|
||||
log.severe("SAAJ0158.impl.version.mismatch.fault");
|
||||
throw new SOAPExceptionImpl("SOAP Version mismatch encountered when trying to add SOAPFault to SOAPBody");
|
||||
}
|
||||
Iterator<Node> it = this.getChildElements();
|
||||
Iterator<javax.xml.soap.Node> it = this.getChildElements();
|
||||
if (it.hasNext()) {
|
||||
log.severe("SAAJ0156.impl.adding.fault.error");
|
||||
throw new SOAPExceptionImpl("Cannot add SOAPFault as a child of a non-Empty SOAPBody");
|
||||
@ -542,8 +570,7 @@ public class ElementImpl implements SOAPElement, SOAPBodyElement {
|
||||
// preserve the encodingStyle attr as it may get lost in the import
|
||||
String encodingStyle = element.getEncodingStyle();
|
||||
|
||||
final Element domElement = ((ElementImpl) element).getDomElement();
|
||||
final Element importedElement = importElement(domElement);
|
||||
final Element importedElement = importElement(element);
|
||||
addNode(importedElement);
|
||||
|
||||
final SOAPElement converted = convertToSoapElement(importedElement);
|
||||
@ -603,7 +630,7 @@ public class ElementImpl implements SOAPElement, SOAPBodyElement {
|
||||
}
|
||||
|
||||
protected void addNode(org.w3c.dom.Node newElement) throws SOAPException {
|
||||
insertBefore(getSoapDocument().getDomNode(newElement), null);
|
||||
insertBefore(soapDocument.getDomNode(newElement), null);
|
||||
|
||||
if (getOwnerDocument() instanceof DocumentFragment)
|
||||
return;
|
||||
@ -623,7 +650,7 @@ public class ElementImpl implements SOAPElement, SOAPBodyElement {
|
||||
Node child = getFirstChild();
|
||||
while (child != null) {
|
||||
if (child instanceof Element) {
|
||||
return (Element) getSoapDocument().find(child);
|
||||
return (Element) soapDocument.find(child);
|
||||
}
|
||||
child = child.getNextSibling();
|
||||
}
|
||||
@ -634,7 +661,7 @@ public class ElementImpl implements SOAPElement, SOAPBodyElement {
|
||||
Node eachChild = getFirstChild();
|
||||
while (eachChild != null) {
|
||||
if (eachChild instanceof Element) {
|
||||
SOAPElement eachChildSoap = (SOAPElement) getSoapDocument().find(eachChild);
|
||||
SOAPElement eachChildSoap = (SOAPElement) soapDocument.find(eachChild);
|
||||
if (eachChildSoap != null) {
|
||||
if (eachChildSoap.getElementName().equals(name)) {
|
||||
return eachChildSoap;
|
||||
@ -658,6 +685,7 @@ public class ElementImpl implements SOAPElement, SOAPBodyElement {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SOAPElement addTextNode(String text) throws SOAPException {
|
||||
if (text.startsWith(CDATAImpl.cdataUC)
|
||||
|| text.startsWith(CDATAImpl.cdataLC))
|
||||
@ -680,6 +708,7 @@ public class ElementImpl implements SOAPElement, SOAPBodyElement {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SOAPElement addAttribute(Name name, String value)
|
||||
throws SOAPException {
|
||||
addAttributeBare(name, value);
|
||||
@ -689,6 +718,7 @@ public class ElementImpl implements SOAPElement, SOAPBodyElement {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SOAPElement addAttribute(QName qname, String value)
|
||||
throws SOAPException {
|
||||
addAttributeBare(qname, value);
|
||||
@ -731,6 +761,7 @@ public class ElementImpl implements SOAPElement, SOAPBodyElement {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public SOAPElement addNamespaceDeclaration(String prefix, String uri)
|
||||
throws SOAPException {
|
||||
if (prefix.length() > 0) {
|
||||
@ -743,10 +774,12 @@ public class ElementImpl implements SOAPElement, SOAPBodyElement {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAttributeValue(Name name) {
|
||||
return getAttributeValueFrom(this, name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAttributeValue(QName qname) {
|
||||
return getAttributeValueFrom(
|
||||
this,
|
||||
@ -756,9 +789,10 @@ public class ElementImpl implements SOAPElement, SOAPBodyElement {
|
||||
getQualifiedName(qname));
|
||||
}
|
||||
|
||||
public Iterator getAllAttributes() {
|
||||
@Override
|
||||
public Iterator<Name> getAllAttributes() {
|
||||
Iterator<Name> i = getAllAttributesFrom(this);
|
||||
ArrayList<Name> list = new ArrayList<Name>();
|
||||
ArrayList<Name> list = new ArrayList<>();
|
||||
while (i.hasNext()) {
|
||||
Name name = i.next();
|
||||
if (!"xmlns".equalsIgnoreCase(name.getPrefix()))
|
||||
@ -767,9 +801,10 @@ public class ElementImpl implements SOAPElement, SOAPBodyElement {
|
||||
return list.iterator();
|
||||
}
|
||||
|
||||
public Iterator getAllAttributesAsQNames() {
|
||||
@Override
|
||||
public Iterator<QName> getAllAttributesAsQNames() {
|
||||
Iterator<Name> i = getAllAttributesFrom(this);
|
||||
ArrayList<QName> list = new ArrayList<QName>();
|
||||
ArrayList<QName> list = new ArrayList<>();
|
||||
while (i.hasNext()) {
|
||||
Name name = i.next();
|
||||
if (!"xmlns".equalsIgnoreCase(name.getPrefix())) {
|
||||
@ -780,11 +815,13 @@ public class ElementImpl implements SOAPElement, SOAPBodyElement {
|
||||
}
|
||||
|
||||
|
||||
public Iterator getNamespacePrefixes() {
|
||||
@Override
|
||||
public Iterator<String> getNamespacePrefixes() {
|
||||
return doGetNamespacePrefixes(false);
|
||||
}
|
||||
|
||||
public Iterator getVisibleNamespacePrefixes() {
|
||||
@Override
|
||||
public Iterator<String> getVisibleNamespacePrefixes() {
|
||||
return doGetNamespacePrefixes(true);
|
||||
}
|
||||
|
||||
@ -805,11 +842,13 @@ public class ElementImpl implements SOAPElement, SOAPBodyElement {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
findNext();
|
||||
return next != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String next() {
|
||||
findNext();
|
||||
if (next == null) {
|
||||
@ -821,6 +860,7 @@ public class ElementImpl implements SOAPElement, SOAPBodyElement {
|
||||
return last;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
if (last == null) {
|
||||
throw new IllegalStateException();
|
||||
@ -832,18 +872,22 @@ public class ElementImpl implements SOAPElement, SOAPBodyElement {
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public Name getElementName() {
|
||||
return NameImpl.convertToName(elementQName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public QName getElementQName() {
|
||||
return elementQName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeAttribute(Name name) {
|
||||
return removeAttribute(name.getURI(), name.getLocalName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeAttribute(QName name) {
|
||||
return removeAttribute(name.getNamespaceURI(), name.getLocalPart());
|
||||
}
|
||||
@ -860,6 +904,7 @@ public class ElementImpl implements SOAPElement, SOAPBodyElement {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeNamespaceDeclaration(String prefix) {
|
||||
org.w3c.dom.Attr declaration = getNamespaceAttr(prefix);
|
||||
if (declaration == null) {
|
||||
@ -873,12 +918,13 @@ public class ElementImpl implements SOAPElement, SOAPBodyElement {
|
||||
return true;
|
||||
}
|
||||
|
||||
public Iterator<Node> getChildElements() {
|
||||
@Override
|
||||
public Iterator<javax.xml.soap.Node> getChildElements() {
|
||||
return getChildElementsFrom(this);
|
||||
}
|
||||
|
||||
protected SOAPElement convertToSoapElement(Element element) {
|
||||
final Node soapNode = getSoapDocument().findIfPresent(element);
|
||||
final Node soapNode = soapDocument.findIfPresent(element);
|
||||
if (soapNode instanceof SOAPElement) {
|
||||
return (SOAPElement) soapNode;
|
||||
} else {
|
||||
@ -888,6 +934,36 @@ public class ElementImpl implements SOAPElement, SOAPBodyElement {
|
||||
}
|
||||
}
|
||||
|
||||
protected TextImpl convertToSoapText(CharacterData characterData) {
|
||||
final Node soapNode = getSoapDocument().findIfPresent(characterData);
|
||||
if (soapNode instanceof TextImpl) {
|
||||
return (TextImpl) soapNode;
|
||||
} else {
|
||||
TextImpl t = null;
|
||||
switch (characterData.getNodeType()) {
|
||||
case CDATA_SECTION_NODE:
|
||||
t = new CDATAImpl(getSoapDocument(), characterData.getData());
|
||||
break;
|
||||
case COMMENT_NODE:
|
||||
t = new SOAPCommentImpl(getSoapDocument(), characterData.getData());
|
||||
break;
|
||||
case TEXT_NODE:
|
||||
t = new SOAPTextImpl(getSoapDocument(), characterData.getData());
|
||||
break;
|
||||
}
|
||||
Node parent = getSoapDocument().find(characterData.getParentNode());
|
||||
if (parent != null) {
|
||||
parent.replaceChild(t, characterData);
|
||||
} // XXX else throw an exception?
|
||||
|
||||
return t;
|
||||
|
||||
// return replaceElementWithSOAPElement(
|
||||
// element,
|
||||
// (ElementImpl) createElement(NameImpl.copyElementName(element)));
|
||||
}
|
||||
}
|
||||
|
||||
protected SOAPElement replaceElementWithSOAPElement(
|
||||
Element element,
|
||||
ElementImpl copy) {
|
||||
@ -898,13 +974,13 @@ public class ElementImpl implements SOAPElement, SOAPBodyElement {
|
||||
copy.addAttributeBare(name, getAttributeValueFrom(element, name));
|
||||
}
|
||||
|
||||
Iterator<Node> eachChild = getChildElementsFrom(element);
|
||||
Iterator<Node> eachChild = getChildElementsFromDOM(element);
|
||||
while (eachChild.hasNext()) {
|
||||
Node nextChild = eachChild.next();
|
||||
copy.insertBefore(nextChild, null);
|
||||
}
|
||||
|
||||
Node parent = getSoapDocument().find(element.getParentNode());
|
||||
Node parent = soapDocument.find(element.getParentNode());
|
||||
if (parent != null) {
|
||||
parent.replaceChild(copy, element);
|
||||
} // XXX else throw an exception?
|
||||
@ -912,22 +988,22 @@ public class ElementImpl implements SOAPElement, SOAPBodyElement {
|
||||
return copy;
|
||||
}
|
||||
|
||||
protected Iterator<Node> getChildElementNodes() {
|
||||
private Iterator<Node> getChildElementsFromDOM(final Element el) {
|
||||
return new Iterator<Node>() {
|
||||
Iterator<Node> eachNode = getChildElements();
|
||||
Node next = null;
|
||||
Node next = el.getFirstChild();
|
||||
Node nextNext = null;
|
||||
Node last = null;
|
||||
Node soapElement = getSoapDocument().findIfPresent(el);
|
||||
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
if (next == null) {
|
||||
while (eachNode.hasNext()) {
|
||||
Node node = eachNode.next();
|
||||
if (node instanceof Element) {
|
||||
next = getSoapDocument().findIfPresent(node);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (next != null) {
|
||||
return true;
|
||||
}
|
||||
if (nextNext != null) {
|
||||
next = nextNext;
|
||||
}
|
||||
|
||||
return next != null;
|
||||
}
|
||||
|
||||
@ -935,11 +1011,66 @@ public class ElementImpl implements SOAPElement, SOAPBodyElement {
|
||||
if (hasNext()) {
|
||||
last = next;
|
||||
next = null;
|
||||
|
||||
if ((soapElement instanceof ElementImpl)
|
||||
&& (last instanceof Element)) {
|
||||
last =
|
||||
((ElementImpl) soapElement).convertToSoapElement(
|
||||
(Element) last);
|
||||
} else if ((soapElement instanceof ElementImpl) && (last instanceof CharacterData)) {
|
||||
last = ((ElementImpl) soapElement).convertToSoapText(
|
||||
(CharacterData) last);
|
||||
}
|
||||
|
||||
nextNext = last.getNextSibling();
|
||||
return last;
|
||||
}
|
||||
throw new NoSuchElementException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
if (last == null) {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
Node target = last;
|
||||
last = null;
|
||||
el.removeChild(target);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
protected Iterator<Node> getChildElementNodes() {
|
||||
return new Iterator<Node>() {
|
||||
Iterator<javax.xml.soap.Node> eachNode = getChildElements();
|
||||
Node next = null;
|
||||
Node last = null;
|
||||
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
if (next == null) {
|
||||
while (eachNode.hasNext()) {
|
||||
Node node = eachNode.next();
|
||||
if (node instanceof Element) {
|
||||
next = soapDocument.findIfPresent(node);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return next != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public javax.xml.soap.Node next() {
|
||||
if (hasNext()) {
|
||||
last = next;
|
||||
next = null;
|
||||
return (javax.xml.soap.Node) last;
|
||||
}
|
||||
throw new NoSuchElementException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
if (last == null) {
|
||||
throw new IllegalStateException();
|
||||
@ -951,20 +1082,23 @@ public class ElementImpl implements SOAPElement, SOAPBodyElement {
|
||||
};
|
||||
}
|
||||
|
||||
public Iterator getChildElements(final Name name) {
|
||||
@Override
|
||||
public Iterator<javax.xml.soap.Node> getChildElements(final Name name) {
|
||||
return getChildElements(name.getURI(), name.getLocalName());
|
||||
}
|
||||
|
||||
public Iterator getChildElements(final QName qname) {
|
||||
@Override
|
||||
public Iterator<javax.xml.soap.Node> getChildElements(final QName qname) {
|
||||
return getChildElements(qname.getNamespaceURI(), qname.getLocalPart());
|
||||
}
|
||||
|
||||
private Iterator<Node> getChildElements(final String nameUri, final String nameLocal) {
|
||||
return new Iterator<Node>() {
|
||||
private Iterator<javax.xml.soap.Node> getChildElements(final String nameUri, final String nameLocal) {
|
||||
return new Iterator<javax.xml.soap.Node>() {
|
||||
Iterator<Node> eachElement = getChildElementNodes();
|
||||
Node next = null;
|
||||
Node last = null;
|
||||
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
if (next == null) {
|
||||
while (eachElement.hasNext()) {
|
||||
@ -982,15 +1116,17 @@ public class ElementImpl implements SOAPElement, SOAPBodyElement {
|
||||
return next != null;
|
||||
}
|
||||
|
||||
public Node next() {
|
||||
@Override
|
||||
public javax.xml.soap.Node next() {
|
||||
if (!hasNext()) {
|
||||
throw new NoSuchElementException();
|
||||
}
|
||||
last = next;
|
||||
next = null;
|
||||
return last;
|
||||
return (javax.xml.soap.Node) last;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
if (last == null) {
|
||||
throw new IllegalStateException();
|
||||
@ -1002,6 +1138,7 @@ public class ElementImpl implements SOAPElement, SOAPBodyElement {
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeContents() {
|
||||
Node currentChild = getFirstChild();
|
||||
|
||||
@ -1020,6 +1157,7 @@ public class ElementImpl implements SOAPElement, SOAPBodyElement {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEncodingStyle(String encodingStyle) throws SOAPException {
|
||||
if (!"".equals(encodingStyle)) {
|
||||
try {
|
||||
@ -1037,6 +1175,7 @@ public class ElementImpl implements SOAPElement, SOAPBodyElement {
|
||||
tryToFindEncodingStyleAttributeName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEncodingStyle() {
|
||||
String encodingStyle = encodingStyleAttribute.getValue();
|
||||
if (encodingStyle != null)
|
||||
@ -1058,11 +1197,13 @@ public class ElementImpl implements SOAPElement, SOAPBodyElement {
|
||||
}
|
||||
|
||||
// Node methods
|
||||
@Override
|
||||
public String getValue() {
|
||||
javax.xml.soap.Node valueNode = getValueNode();
|
||||
return valueNode == null ? null : valueNode.getValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValue(String value) {
|
||||
Node valueNode = getValueNodeStrict();
|
||||
if (valueNode != null) {
|
||||
@ -1092,7 +1233,7 @@ public class ElementImpl implements SOAPElement, SOAPBodyElement {
|
||||
}
|
||||
|
||||
protected javax.xml.soap.Node getValueNode() {
|
||||
Iterator<Node> i = getChildElements();
|
||||
Iterator<javax.xml.soap.Node> i = getChildElements();
|
||||
while (i.hasNext()) {
|
||||
Node n = i.next();
|
||||
if (n.getNodeType() == org.w3c.dom.Node.TEXT_NODE ||
|
||||
@ -1101,12 +1242,13 @@ public class ElementImpl implements SOAPElement, SOAPBodyElement {
|
||||
normalize();
|
||||
// Should remove the normalization step when this gets fixed in
|
||||
// DOM/Xerces.
|
||||
return getSoapDocument().find(n);
|
||||
return soapDocument.find(n);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setParentElement(SOAPElement element) throws SOAPException {
|
||||
if (element == null) {
|
||||
log.severe("SAAJ0106.impl.no.null.to.parent.elem");
|
||||
@ -1138,12 +1280,13 @@ public class ElementImpl implements SOAPElement, SOAPBodyElement {
|
||||
encodingStyleAttribute.setName(encodingStyleAttributeName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SOAPElement getParentElement() {
|
||||
Node parentNode = getParentNode();
|
||||
if (parentNode instanceof SOAPDocument) {
|
||||
return null;
|
||||
}
|
||||
return (SOAPElement) getSoapDocument().find(parentNode);
|
||||
return (SOAPElement) soapDocument.find(parentNode);
|
||||
}
|
||||
|
||||
protected String getSOAPNamespace() {
|
||||
@ -1167,6 +1310,7 @@ public class ElementImpl implements SOAPElement, SOAPBodyElement {
|
||||
return soapNamespace;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detachNode() {
|
||||
Node parent = getParentNode();
|
||||
if (parent != null) {
|
||||
@ -1184,6 +1328,7 @@ public class ElementImpl implements SOAPElement, SOAPBodyElement {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void recycleNode() {
|
||||
detachNode();
|
||||
// TBD
|
||||
@ -1260,10 +1405,12 @@ public class ElementImpl implements SOAPElement, SOAPBodyElement {
|
||||
int attributeIndex = 0;
|
||||
String currentName;
|
||||
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
return attributeIndex < attributesLength;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Name next() {
|
||||
if (!hasNext()) {
|
||||
throw new NoSuchElementException();
|
||||
@ -1283,6 +1430,7 @@ public class ElementImpl implements SOAPElement, SOAPBodyElement {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
if (currentName == null) {
|
||||
throw new IllegalStateException();
|
||||
@ -1331,13 +1479,14 @@ public class ElementImpl implements SOAPElement, SOAPBodyElement {
|
||||
return attribute == null ? null : attribute.getValue();
|
||||
}
|
||||
|
||||
protected Iterator<Node> getChildElementsFrom(final Element element) {
|
||||
return new Iterator<Node>() {
|
||||
protected Iterator<javax.xml.soap.Node> getChildElementsFrom(final Element element) {
|
||||
return new Iterator<javax.xml.soap.Node>() {
|
||||
Node next = element.getFirstChild();
|
||||
Node nextNext = null;
|
||||
Node last = null;
|
||||
Node soapElement = getSoapDocument().findIfPresent(element);
|
||||
Node soapElement = soapDocument.findIfPresent(element);
|
||||
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
if (next != null) {
|
||||
return true;
|
||||
@ -1349,7 +1498,8 @@ public class ElementImpl implements SOAPElement, SOAPBodyElement {
|
||||
return next != null;
|
||||
}
|
||||
|
||||
public Node next() {
|
||||
@Override
|
||||
public javax.xml.soap.Node next() {
|
||||
if (hasNext()) {
|
||||
last = next;
|
||||
next = null;
|
||||
@ -1362,11 +1512,12 @@ public class ElementImpl implements SOAPElement, SOAPBodyElement {
|
||||
}
|
||||
|
||||
nextNext = last.getNextSibling();
|
||||
return getSoapDocument().findIfPresent(last);
|
||||
return (javax.xml.soap.Node) soapDocument.findIfPresent(last);
|
||||
}
|
||||
throw new NoSuchElementException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
if (last == null) {
|
||||
throw new IllegalStateException();
|
||||
@ -1428,6 +1579,7 @@ public class ElementImpl implements SOAPElement, SOAPBodyElement {
|
||||
//TODO: This is a temporary SAAJ workaround for optimizing XWS
|
||||
// should be removed once the corresponding JAXP bug is fixed
|
||||
// It appears the bug will be fixed in JAXP 1.4 (not by Appserver 9 timeframe)
|
||||
@Override
|
||||
public void setAttributeNS(
|
||||
String namespaceURI,String qualifiedName, String value) {
|
||||
int index = qualifiedName.indexOf(':');
|
||||
@ -1483,7 +1635,7 @@ public class ElementImpl implements SOAPElement, SOAPBodyElement {
|
||||
|
||||
@Override
|
||||
public NodeList getElementsByTagNameNS(String namespaceURI, String localName) throws DOMException {
|
||||
return new NodeListImpl(getSoapDocument(), element.getElementsByTagNameNS(namespaceURI, localName));
|
||||
return new NodeListImpl(soapDocument, element.getElementsByTagNameNS(namespaceURI, localName));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -1538,37 +1690,37 @@ public class ElementImpl implements SOAPElement, SOAPBodyElement {
|
||||
|
||||
@Override
|
||||
public Node getParentNode() {
|
||||
return getSoapDocument().find(element.getParentNode());
|
||||
return soapDocument.find(element.getParentNode());
|
||||
}
|
||||
|
||||
@Override
|
||||
public NodeList getChildNodes() {
|
||||
return new NodeListImpl(getSoapDocument(), element.getChildNodes());
|
||||
return new NodeListImpl(soapDocument, element.getChildNodes());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Node getFirstChild() {
|
||||
return getSoapDocument().findIfPresent(element.getFirstChild());
|
||||
return soapDocument.findIfPresent(element.getFirstChild());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Node getLastChild() {
|
||||
return getSoapDocument().findIfPresent(element.getLastChild());
|
||||
return soapDocument.findIfPresent(element.getLastChild());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Node getPreviousSibling() {
|
||||
return getSoapDocument().findIfPresent(element.getPreviousSibling());
|
||||
return soapDocument.findIfPresent(element.getPreviousSibling());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Node getNextSibling() {
|
||||
return getSoapDocument().findIfPresent(element.getNextSibling());
|
||||
return soapDocument.findIfPresent(element.getNextSibling());
|
||||
}
|
||||
|
||||
@Override
|
||||
public NamedNodeMap getAttributes() {
|
||||
return element.getAttributes();
|
||||
return new NamedNodeMapImpl(element.getAttributes(), soapDocument);
|
||||
}
|
||||
|
||||
public Element getDomElement() {
|
||||
|
@ -100,6 +100,7 @@ public abstract class EnvelopeImpl extends ElementImpl implements LazyEnvelope {
|
||||
protected abstract NameImpl getHeaderName(String prefix);
|
||||
protected abstract NameImpl getBodyName(String prefix);
|
||||
|
||||
@Override
|
||||
public SOAPHeader addHeader() throws SOAPException {
|
||||
return addHeader(null);
|
||||
}
|
||||
@ -140,6 +141,7 @@ public abstract class EnvelopeImpl extends ElementImpl implements LazyEnvelope {
|
||||
header = hdr;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SOAPHeader getHeader() throws SOAPException {
|
||||
lookForHeader();
|
||||
return header;
|
||||
@ -152,6 +154,7 @@ public abstract class EnvelopeImpl extends ElementImpl implements LazyEnvelope {
|
||||
body = bodyChildElement;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SOAPBody addBody() throws SOAPException {
|
||||
return addBody(null);
|
||||
}
|
||||
@ -176,6 +179,7 @@ public abstract class EnvelopeImpl extends ElementImpl implements LazyEnvelope {
|
||||
return body;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SOAPElement addElement(Name name) throws SOAPException {
|
||||
if (getBodyName(null).equals(name)) {
|
||||
return addBody(name.getPrefix());
|
||||
@ -187,6 +191,7 @@ public abstract class EnvelopeImpl extends ElementImpl implements LazyEnvelope {
|
||||
return super.addElement(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SOAPElement addElement(QName name) throws SOAPException {
|
||||
if (getBodyName(null).equals(NameImpl.convertToName(name))) {
|
||||
return addBody(name.getPrefix());
|
||||
@ -198,15 +203,18 @@ public abstract class EnvelopeImpl extends ElementImpl implements LazyEnvelope {
|
||||
return super.addElement(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SOAPBody getBody() throws SOAPException {
|
||||
lookForBody();
|
||||
return body;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Source getContent() {
|
||||
return new DOMSource(getOwnerDocument());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Name createName(String localName, String prefix, String uri)
|
||||
throws SOAPException {
|
||||
|
||||
@ -241,6 +249,7 @@ public abstract class EnvelopeImpl extends ElementImpl implements LazyEnvelope {
|
||||
return NameImpl.create(localName, prefix, namespace);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Name createName(String localName) throws SOAPException {
|
||||
return NameImpl.createFromUnqualifiedName(localName);
|
||||
}
|
||||
@ -257,6 +266,7 @@ public abstract class EnvelopeImpl extends ElementImpl implements LazyEnvelope {
|
||||
charset = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void output(OutputStream out) throws IOException {
|
||||
try {
|
||||
// materializeBody();
|
||||
@ -301,6 +311,7 @@ public abstract class EnvelopeImpl extends ElementImpl implements LazyEnvelope {
|
||||
/**
|
||||
* Serialize to FI if boolean parameter set.
|
||||
*/
|
||||
@Override
|
||||
public void output(OutputStream out, boolean isFastInfoset)
|
||||
throws IOException
|
||||
{
|
||||
@ -353,6 +364,7 @@ public abstract class EnvelopeImpl extends ElementImpl implements LazyEnvelope {
|
||||
// }
|
||||
|
||||
|
||||
@Override
|
||||
public SOAPElement setElementQName(QName newName) throws SOAPException {
|
||||
log.log(Level.SEVERE,
|
||||
"SAAJ0146.impl.invalid.name.change.requested",
|
||||
@ -389,6 +401,7 @@ public abstract class EnvelopeImpl extends ElementImpl implements LazyEnvelope {
|
||||
final DOMStreamReader reader = new DOMStreamReader(this);
|
||||
XMLStreamReaderToXMLStreamWriter writingBridge = new XMLStreamReaderToXMLStreamWriter();
|
||||
writingBridge.bridge( new XMLStreamReaderToXMLStreamWriter.Breakpoint(reader, writer) {
|
||||
@Override
|
||||
public boolean proceedAfterStartElement() {
|
||||
if ("Body".equals(reader.getLocalName()) && soapEnvNS.equals(reader.getNamespaceURI()) ){
|
||||
return false;
|
||||
|
@ -54,6 +54,7 @@ public abstract class FaultElementImpl
|
||||
|
||||
protected abstract boolean isStandardFaultElement();
|
||||
|
||||
@Override
|
||||
public SOAPElement setElementQName(QName newName) throws SOAPException {
|
||||
log.log(Level.SEVERE,
|
||||
"SAAJ0146.impl.invalid.name.change.requested",
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -30,6 +30,7 @@ import javax.xml.soap.*;
|
||||
|
||||
import com.sun.xml.internal.messaging.saaj.soap.SOAPDocumentImpl;
|
||||
import com.sun.xml.internal.messaging.saaj.soap.name.NameImpl;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
public abstract class HeaderElementImpl
|
||||
extends ElementImpl
|
||||
@ -47,6 +48,10 @@ public abstract class HeaderElementImpl
|
||||
super(ownerDoc, qname);
|
||||
}
|
||||
|
||||
public HeaderElementImpl(SOAPDocumentImpl ownerDoc, Element domElement) {
|
||||
super(ownerDoc, domElement);
|
||||
}
|
||||
|
||||
protected abstract NameImpl getActorAttributeName();
|
||||
protected abstract NameImpl getRoleAttributeName();
|
||||
protected abstract NameImpl getMustunderstandAttributeName();
|
||||
@ -58,6 +63,7 @@ public abstract class HeaderElementImpl
|
||||
protected abstract String getActorOrRole();
|
||||
|
||||
|
||||
@Override
|
||||
public void setParentElement(SOAPElement element) throws SOAPException {
|
||||
if (!(element instanceof SOAPHeader)) {
|
||||
log.severe("SAAJ0130.impl.header.elem.parent.mustbe.header");
|
||||
@ -67,6 +73,7 @@ public abstract class HeaderElementImpl
|
||||
super.setParentElement(element);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setActor(String actorUri) {
|
||||
try {
|
||||
removeAttribute(getActorAttributeName());
|
||||
@ -76,6 +83,7 @@ public abstract class HeaderElementImpl
|
||||
}
|
||||
|
||||
//SOAP 1.2 supports Role
|
||||
@Override
|
||||
public void setRole(String roleUri) throws SOAPException {
|
||||
// runtime exception thrown if called for SOAP 1.1
|
||||
removeAttribute(getRoleAttributeName());
|
||||
@ -85,6 +93,7 @@ public abstract class HeaderElementImpl
|
||||
|
||||
Name actorAttNameWithoutNS = NameImpl.createFromTagName("actor");
|
||||
|
||||
@Override
|
||||
public String getActor() {
|
||||
String actor = getAttributeValue(getActorAttributeName());
|
||||
return actor;
|
||||
@ -92,12 +101,14 @@ public abstract class HeaderElementImpl
|
||||
|
||||
Name roleAttNameWithoutNS = NameImpl.createFromTagName("role");
|
||||
|
||||
@Override
|
||||
public String getRole() {
|
||||
// runtime exception thrown for 1.1
|
||||
String role = getAttributeValue(getRoleAttributeName());
|
||||
return role;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMustUnderstand(boolean mustUnderstand) {
|
||||
try {
|
||||
removeAttribute(getMustunderstandAttributeName());
|
||||
@ -108,6 +119,7 @@ public abstract class HeaderElementImpl
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getMustUnderstand() {
|
||||
String mu = getAttributeValue(getMustunderstandAttributeName());
|
||||
|
||||
@ -117,6 +129,7 @@ public abstract class HeaderElementImpl
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRelay(boolean relay) throws SOAPException {
|
||||
// runtime exception thrown for 1.1
|
||||
removeAttribute(getRelayAttributeName());
|
||||
@ -125,6 +138,7 @@ public abstract class HeaderElementImpl
|
||||
getRelayLiteralValue(relay));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getRelay() {
|
||||
String mu = getAttributeValue(getRelayAttributeName());
|
||||
if (mu != null)
|
||||
|
@ -25,19 +25,25 @@
|
||||
|
||||
package com.sun.xml.internal.messaging.saaj.soap.impl;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import javax.xml.namespace.QName;
|
||||
import javax.xml.soap.*;
|
||||
|
||||
import com.sun.xml.internal.messaging.saaj.util.SAAJUtil;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
import com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl;
|
||||
import com.sun.xml.internal.messaging.saaj.soap.SOAPDocument;
|
||||
import com.sun.xml.internal.messaging.saaj.soap.SOAPDocumentImpl;
|
||||
import com.sun.xml.internal.messaging.saaj.soap.name.NameImpl;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import javax.xml.soap.Name;
|
||||
import javax.xml.soap.SOAPElement;
|
||||
import javax.xml.soap.SOAPEnvelope;
|
||||
import javax.xml.soap.SOAPException;
|
||||
import javax.xml.soap.SOAPHeader;
|
||||
import javax.xml.soap.SOAPHeaderElement;
|
||||
|
||||
public abstract class HeaderImpl extends ElementImpl implements SOAPHeader {
|
||||
protected static final boolean MUST_UNDERSTAND_ONLY = false;
|
||||
@ -58,6 +64,7 @@ public abstract class HeaderImpl extends ElementImpl implements SOAPHeader {
|
||||
protected abstract NameImpl getUpgradeName();
|
||||
protected abstract NameImpl getSupportedEnvelopeName();
|
||||
|
||||
@Override
|
||||
public SOAPHeaderElement addHeaderElement(Name name) throws SOAPException {
|
||||
SOAPElement newHeaderElement =
|
||||
ElementFactory.createNamedElement(
|
||||
@ -81,6 +88,7 @@ public abstract class HeaderImpl extends ElementImpl implements SOAPHeader {
|
||||
return (SOAPHeaderElement) newHeaderElement;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SOAPHeaderElement addHeaderElement(QName name) throws SOAPException {
|
||||
SOAPElement newHeaderElement =
|
||||
ElementFactory.createNamedElement(
|
||||
@ -104,19 +112,23 @@ public abstract class HeaderImpl extends ElementImpl implements SOAPHeader {
|
||||
return (SOAPHeaderElement) newHeaderElement;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SOAPElement addElement(Name name) throws SOAPException {
|
||||
return addHeaderElement(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SOAPElement addElement(QName name) throws SOAPException {
|
||||
return addHeaderElement(name);
|
||||
}
|
||||
|
||||
public Iterator examineHeaderElements(String actor) {
|
||||
@Override
|
||||
public Iterator<SOAPHeaderElement> examineHeaderElements(String actor) {
|
||||
return getHeaderElementsForActor(actor, false, false);
|
||||
}
|
||||
|
||||
public Iterator extractHeaderElements(String actor) {
|
||||
@Override
|
||||
public Iterator<SOAPHeaderElement> extractHeaderElements(String actor) {
|
||||
return getHeaderElementsForActor(actor, true, false);
|
||||
}
|
||||
|
||||
@ -135,9 +147,9 @@ public abstract class HeaderImpl extends ElementImpl implements SOAPHeader {
|
||||
String actor,
|
||||
boolean detach,
|
||||
boolean mustUnderstand) {
|
||||
List<SOAPHeaderElement> elementList = new ArrayList<SOAPHeaderElement>();
|
||||
List<SOAPHeaderElement> elementList = new ArrayList<>();
|
||||
|
||||
Iterator<org.w3c.dom.Node> eachChild = getChildElements();
|
||||
Iterator<javax.xml.soap.Node> eachChild = getChildElements();
|
||||
|
||||
org.w3c.dom.Node currentChild = iterate(eachChild);
|
||||
while (currentChild != null) {
|
||||
@ -181,6 +193,7 @@ public abstract class HeaderImpl extends ElementImpl implements SOAPHeader {
|
||||
return each.hasNext() ? each.next() : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setParentElement(SOAPElement element) throws SOAPException {
|
||||
if (!(element instanceof SOAPEnvelope)) {
|
||||
log.severe("SAAJ0133.impl.header.parent.mustbe.envelope");
|
||||
@ -193,6 +206,7 @@ public abstract class HeaderImpl extends ElementImpl implements SOAPHeader {
|
||||
// namespace qualified. Holds for both SOAP versions.
|
||||
// TODO - This check needs to be made for other addChildElement() methods
|
||||
// as well.
|
||||
@Override
|
||||
public SOAPElement addChildElement(String localName) throws SOAPException {
|
||||
|
||||
SOAPElement element = super.addChildElement(localName);
|
||||
@ -205,19 +219,23 @@ public abstract class HeaderImpl extends ElementImpl implements SOAPHeader {
|
||||
return element;
|
||||
}
|
||||
|
||||
public Iterator examineAllHeaderElements() {
|
||||
@Override
|
||||
public Iterator<SOAPHeaderElement> examineAllHeaderElements() {
|
||||
return getHeaderElements(null, false, MUST_UNDERSTAND_ONLY);
|
||||
}
|
||||
|
||||
public Iterator examineMustUnderstandHeaderElements(String actor) {
|
||||
@Override
|
||||
public Iterator<SOAPHeaderElement> examineMustUnderstandHeaderElements(String actor) {
|
||||
return getHeaderElements(actor, false, true);
|
||||
|
||||
}
|
||||
|
||||
public Iterator extractAllHeaderElements() {
|
||||
@Override
|
||||
public Iterator<SOAPHeaderElement> extractAllHeaderElements() {
|
||||
return getHeaderElements(null, true, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SOAPHeaderElement addUpgradeHeaderElement(Iterator supportedSoapUris)
|
||||
throws SOAPException {
|
||||
if (supportedSoapUris == null) {
|
||||
@ -241,18 +259,19 @@ public abstract class HeaderImpl extends ElementImpl implements SOAPHeader {
|
||||
NameImpl.createFromUnqualifiedName("qname"),
|
||||
ns + ":Envelope");
|
||||
subElement.addNamespaceDeclaration(
|
||||
ns,
|
||||
(String) supportedSoapUris.next());
|
||||
ns, (String) supportedSoapUris.next());
|
||||
i ++;
|
||||
}
|
||||
return upgradeHeaderElement;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SOAPHeaderElement addUpgradeHeaderElement(String supportedSoapUri)
|
||||
throws SOAPException {
|
||||
return addUpgradeHeaderElement(new String[] {supportedSoapUri});
|
||||
}
|
||||
|
||||
@Override
|
||||
public SOAPHeaderElement addUpgradeHeaderElement(String[] supportedSoapUris)
|
||||
throws SOAPException {
|
||||
|
||||
@ -280,6 +299,7 @@ public abstract class HeaderImpl extends ElementImpl implements SOAPHeader {
|
||||
return upgradeHeaderElement;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SOAPElement convertToSoapElement(Element element) {
|
||||
final org.w3c.dom.Node soapNode = getSoapDocument().findIfPresent(element);
|
||||
if (soapNode instanceof SOAPHeaderElement) {
|
||||
@ -298,6 +318,7 @@ public abstract class HeaderImpl extends ElementImpl implements SOAPHeader {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public SOAPElement setElementQName(QName newName) throws SOAPException {
|
||||
log.log(Level.SEVERE,
|
||||
"SAAJ0146.impl.invalid.name.change.requested",
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
# Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
#
|
||||
# This code is free software; you can redistribute it and/or modify it
|
||||
@ -46,7 +46,7 @@ SAAJ0122.impl.body.already.exists=SAAJ0122: Can't add a body when one is already
|
||||
SAAJ0123.impl.no.reserved.xmlns=SAAJ0123: Cannot declare reserved xmlns prefix
|
||||
SAAJ0124.impl.qualified.name.cannot.be.xmlns=SAAJ0124: Qualified name cannot be xmlns
|
||||
#SAAJ0125.impl.URI.cannot.be.null=SAAJ0125: URI cannot be null
|
||||
SAAJ0126.impl.cannot.locate.ns=SAAJ0126: Unable to locate namespace for prefix {0}
|
||||
#SAAJ0126.impl.cannot.locate.ns=SAAJ0126: Unable to locate namespace for prefix {0}
|
||||
SAAJ0127.impl.no.null.for.parent.elem=SAAJ0127: Cannot pass NULL to setParentElement
|
||||
|
||||
SAAJ0130.impl.header.elem.parent.mustbe.header=SAAJ0130: Parent of a SOAPHeaderElement has to be a SOAPHeader
|
||||
@ -60,7 +60,7 @@ SAAJ0141.impl.detail.exists=SAAJ0141: Detail already exists
|
||||
SAAJ0142.impl.reason.or.text.not.supported=SAAJ0142: Fault/Reason/Text not supported by this SOAP version, try SOAP 1.2 or later
|
||||
SAAJ0143.impl.node.not.supported=SAAJ0143: Fault/Node not supported by this SOAP version, try SOAP 1.2 or later
|
||||
SAAJ0144.impl.role.not.supported=SAAJ0144: Fault/Role not supported by this SOAP version, try SOAP 1.2 or later
|
||||
SAAJ0145.impl.no.null.to.parent.elem=SAAJ0145: Cannot pass NULL to setParentElement
|
||||
#SAAJ0145.impl.no.null.to.parent.elem=SAAJ0145: Cannot pass NULL to setParentElement
|
||||
SAAJ0146.impl.invalid.name.change.requested=SAAJ0146: Cannot change name of element {0} to {1}
|
||||
SAAJ0147.impl.invalid.uri.change.requested=SAAJ0147: Cannot change the URI for prefix {0} from {1} to {2} in setElementQName
|
||||
SAAJ0148.impl.invalid.prefix.for.uri=Non-empty namespace URI: {0} for an empty prefix in SetElementQName
|
||||
|
@ -0,0 +1,94 @@
|
||||
/*
|
||||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.xml.internal.messaging.saaj.soap.impl;
|
||||
|
||||
import com.sun.xml.internal.messaging.saaj.soap.SOAPDocumentImpl;
|
||||
import org.w3c.dom.DOMException;
|
||||
import org.w3c.dom.NamedNodeMap;
|
||||
import org.w3c.dom.Node;
|
||||
|
||||
/**
|
||||
* {@link NamedNodeMap} wrapper, finding SOAP elements automatically when possible.
|
||||
*
|
||||
* @author Roman Grigoriadi
|
||||
*/
|
||||
public class NamedNodeMapImpl implements NamedNodeMap {
|
||||
|
||||
private final NamedNodeMap namedNodeMap;
|
||||
|
||||
private final SOAPDocumentImpl soapDocument;
|
||||
|
||||
/**
|
||||
* Create wrapper.
|
||||
*
|
||||
* @param namedNodeMap node map to wrap
|
||||
* @param soapDocument soap document to find soap elements
|
||||
*/
|
||||
public NamedNodeMapImpl(NamedNodeMap namedNodeMap, SOAPDocumentImpl soapDocument) {
|
||||
this.namedNodeMap = namedNodeMap;
|
||||
this.soapDocument = soapDocument;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Node getNamedItem(String name) {
|
||||
return soapDocument.findIfPresent(namedNodeMap.getNamedItem(name));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Node setNamedItem(Node arg) throws DOMException {
|
||||
return namedNodeMap.setNamedItem(arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Node removeNamedItem(String name) throws DOMException {
|
||||
return namedNodeMap.removeNamedItem(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Node item(int index) {
|
||||
return namedNodeMap.item(index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLength() {
|
||||
return namedNodeMap.getLength();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Node getNamedItemNS(String namespaceURI, String localName) throws DOMException {
|
||||
return namedNodeMap.getNamedItemNS(namespaceURI, localName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Node setNamedItemNS(Node arg) throws DOMException {
|
||||
return namedNodeMap.setNamedItemNS(arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Node removeNamedItemNS(String namespaceURI, String localName) throws DOMException {
|
||||
return namedNodeMap.removeNamedItemNS(namespaceURI, localName);
|
||||
}
|
||||
}
|
@ -25,327 +25,64 @@
|
||||
|
||||
package com.sun.xml.internal.messaging.saaj.soap.impl;
|
||||
|
||||
import java.util.ResourceBundle;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import javax.xml.soap.SOAPElement;
|
||||
import javax.xml.soap.SOAPException;
|
||||
|
||||
import com.sun.xml.internal.messaging.saaj.util.SAAJUtil;
|
||||
import org.w3c.dom.CharacterData;
|
||||
import org.w3c.dom.Comment;
|
||||
import org.w3c.dom.DOMException;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.NamedNodeMap;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
import org.w3c.dom.Text;
|
||||
|
||||
import com.sun.xml.internal.messaging.saaj.soap.SOAPDocumentImpl;
|
||||
import com.sun.xml.internal.messaging.saaj.util.LogDomainConstants;
|
||||
import org.w3c.dom.UserDataHandler;
|
||||
import static com.sun.xml.internal.messaging.saaj.soap.impl.TextImpl.log;
|
||||
|
||||
public class SOAPCommentImpl
|
||||
implements javax.xml.soap.Text, org.w3c.dom.Comment {
|
||||
|
||||
protected static final Logger log =
|
||||
Logger.getLogger(LogDomainConstants.SOAP_IMPL_DOMAIN,
|
||||
"com.sun.xml.internal.messaging.saaj.soap.impl.LocalStrings");
|
||||
protected static ResourceBundle rb =
|
||||
log.getResourceBundle();
|
||||
|
||||
@Override
|
||||
public String getData() throws DOMException {
|
||||
return comment.getData();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setData(String data) throws DOMException {
|
||||
comment.setData(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLength() {
|
||||
return comment.getLength();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String substringData(int offset, int count) throws DOMException {
|
||||
return comment.substringData(offset, count);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void appendData(String arg) throws DOMException {
|
||||
comment.appendData(arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void insertData(int offset, String arg) throws DOMException {
|
||||
comment.insertData(offset, arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteData(int offset, int count) throws DOMException {
|
||||
comment.deleteData(offset, count);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void replaceData(int offset, int count, String arg) throws DOMException {
|
||||
comment.replaceData(offset, count, arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNodeName() {
|
||||
return comment.getNodeName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNodeValue() throws DOMException {
|
||||
return comment.getNodeValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setNodeValue(String nodeValue) throws DOMException {
|
||||
comment.setNodeValue(nodeValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public short getNodeType() {
|
||||
return comment.getNodeType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Node getParentNode() {
|
||||
return comment.getParentNode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public NodeList getChildNodes() {
|
||||
return comment.getChildNodes();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Node getFirstChild() {
|
||||
return comment.getFirstChild();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Node getLastChild() {
|
||||
return comment.getLastChild();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Node getPreviousSibling() {
|
||||
return comment.getPreviousSibling();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Node getNextSibling() {
|
||||
return comment.getNextSibling();
|
||||
}
|
||||
|
||||
@Override
|
||||
public NamedNodeMap getAttributes() {
|
||||
return comment.getAttributes();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Document getOwnerDocument() {
|
||||
return comment.getOwnerDocument();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Node insertBefore(Node newChild, Node refChild) throws DOMException {
|
||||
return comment.insertBefore(newChild, refChild);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Node replaceChild(Node newChild, Node oldChild) throws DOMException {
|
||||
return comment.replaceChild(newChild, oldChild);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Node removeChild(Node oldChild) throws DOMException {
|
||||
return comment.removeChild(oldChild);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Node appendChild(Node newChild) throws DOMException {
|
||||
return comment.appendChild(newChild);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasChildNodes() {
|
||||
return comment.hasChildNodes();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Node cloneNode(boolean deep) {
|
||||
return comment.cloneNode(deep);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void normalize() {
|
||||
comment.normalize();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSupported(String feature, String version) {
|
||||
return comment.isSupported(feature, version);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNamespaceURI() {
|
||||
return comment.getNamespaceURI();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPrefix() {
|
||||
return comment.getPrefix();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPrefix(String prefix) throws DOMException {
|
||||
comment.setPrefix(prefix);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLocalName() {
|
||||
return comment.getLocalName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasAttributes() {
|
||||
return comment.hasAttributes();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBaseURI() {
|
||||
return comment.getBaseURI();
|
||||
}
|
||||
|
||||
@Override
|
||||
public short compareDocumentPosition(Node other) throws DOMException {
|
||||
return comment.compareDocumentPosition(other);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextContent() throws DOMException {
|
||||
return comment.getTextContent();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTextContent(String textContent) throws DOMException {
|
||||
comment.setTextContent(textContent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSameNode(Node other) {
|
||||
return comment.isSameNode(other);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String lookupPrefix(String namespaceURI) {
|
||||
return comment.lookupPrefix(namespaceURI);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDefaultNamespace(String namespaceURI) {
|
||||
return comment.isDefaultNamespace(namespaceURI);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String lookupNamespaceURI(String prefix) {
|
||||
return comment.lookupNamespaceURI(prefix);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEqualNode(Node arg) {
|
||||
return comment.isEqualNode(arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getFeature(String feature, String version) {
|
||||
return comment.getFeature(feature, version);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object setUserData(String key, Object data, UserDataHandler handler) {
|
||||
return comment.setUserData(key, data, handler);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getUserData(String key) {
|
||||
return comment.getUserData(key);
|
||||
}
|
||||
|
||||
private Comment comment;
|
||||
public class SOAPCommentImpl extends TextImpl<Comment> implements Comment {
|
||||
|
||||
public SOAPCommentImpl(SOAPDocumentImpl ownerDoc, String text) {
|
||||
comment = ownerDoc.getDomDocument().createComment(text);
|
||||
ownerDoc.register(this);
|
||||
super(ownerDoc, text);
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
String nodeValue = getNodeValue();
|
||||
return (nodeValue.equals("") ? null : nodeValue);
|
||||
public SOAPCommentImpl(SOAPDocumentImpl ownerDoc, CharacterData data) {
|
||||
super(ownerDoc, data);
|
||||
}
|
||||
|
||||
public void setValue(String text) {
|
||||
setNodeValue(text);
|
||||
@Override
|
||||
protected Comment createN(SOAPDocumentImpl ownerDoc, String text) {
|
||||
Comment c = ownerDoc.getDomDocument().createComment(text);
|
||||
// ownerDoc.register(this);
|
||||
return c;
|
||||
}
|
||||
|
||||
|
||||
public void setParentElement(SOAPElement element) throws SOAPException {
|
||||
if (element == null) {
|
||||
log.severe("SAAJ0112.impl.no.null.to.parent.elem");
|
||||
throw new SOAPException("Cannot pass NULL to setParentElement");
|
||||
}
|
||||
((ElementImpl) element).addNode(this);
|
||||
}
|
||||
|
||||
public SOAPElement getParentElement() {
|
||||
return (SOAPElement) getParentNode();
|
||||
}
|
||||
|
||||
public void detachNode() {
|
||||
org.w3c.dom.Node parent = getParentNode();
|
||||
if (parent != null) {
|
||||
parent.removeChild(this);
|
||||
}
|
||||
}
|
||||
|
||||
public void recycleNode() {
|
||||
detachNode();
|
||||
// TBD
|
||||
// - add this to the factory so subsequent
|
||||
// creations can reuse this object.
|
||||
@Override
|
||||
protected Comment createN(SOAPDocumentImpl ownerDoc, CharacterData data) {
|
||||
Comment c = (Comment) data;
|
||||
return c;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isComment() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Text splitText(int offset) throws DOMException {
|
||||
log.severe("SAAJ0113.impl.cannot.split.text.from.comment");
|
||||
throw new UnsupportedOperationException("Cannot split text from a Comment Node.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Text replaceWholeText(String content) throws DOMException {
|
||||
log.severe("SAAJ0114.impl.cannot.replace.wholetext.from.comment");
|
||||
throw new UnsupportedOperationException("Cannot replace Whole Text from a Comment Node.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getWholeText() {
|
||||
//TODO: maybe we have to implement this in future.
|
||||
throw new UnsupportedOperationException("Not Supported");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isElementContentWhitespace() {
|
||||
//TODO: maybe we have to implement this in future.
|
||||
throw new UnsupportedOperationException("Not Supported");
|
||||
}
|
||||
|
||||
public Comment getDomElement() {
|
||||
return comment;
|
||||
}
|
||||
}
|
||||
|
@ -25,316 +25,55 @@
|
||||
|
||||
package com.sun.xml.internal.messaging.saaj.soap.impl;
|
||||
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import javax.xml.soap.SOAPElement;
|
||||
import javax.xml.soap.SOAPException;
|
||||
|
||||
import com.sun.xml.internal.messaging.saaj.soap.SOAPDocumentImpl;
|
||||
import com.sun.xml.internal.messaging.saaj.util.LogDomainConstants;
|
||||
import org.w3c.dom.CharacterData;
|
||||
import org.w3c.dom.DOMException;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.NamedNodeMap;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
import org.w3c.dom.Text;
|
||||
import org.w3c.dom.UserDataHandler;
|
||||
|
||||
public class SOAPTextImpl
|
||||
implements javax.xml.soap.Text, org.w3c.dom.Text {
|
||||
public class SOAPTextImpl extends TextImpl<Text> implements Text {
|
||||
|
||||
public SOAPTextImpl(SOAPDocumentImpl ownerDoc, String text) {
|
||||
super(ownerDoc, text);
|
||||
}
|
||||
|
||||
public SOAPTextImpl(SOAPDocumentImpl ownerDoc, CharacterData data) {
|
||||
super(ownerDoc, data);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Text createN(SOAPDocumentImpl ownerDoc, String text) {
|
||||
Text t = ownerDoc.getDomDocument().createTextNode(text);
|
||||
// ownerDoc.register(this);
|
||||
return t;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Text createN(SOAPDocumentImpl ownerDoc, CharacterData data) {
|
||||
Text t = (Text) data;
|
||||
return t;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Text splitText(int offset) throws DOMException {
|
||||
return textNode.splitText(offset);
|
||||
return getDomElement().splitText(offset);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isElementContentWhitespace() {
|
||||
return textNode.isElementContentWhitespace();
|
||||
return getDomElement().isElementContentWhitespace();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getWholeText() {
|
||||
return textNode.getWholeText();
|
||||
return getDomElement().getWholeText();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Text replaceWholeText(String content) throws DOMException {
|
||||
return textNode.replaceWholeText(content);
|
||||
return getDomElement().replaceWholeText(content);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getData() throws DOMException {
|
||||
return textNode.getData();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setData(String data) throws DOMException {
|
||||
textNode.setData(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLength() {
|
||||
return textNode.getLength();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String substringData(int offset, int count) throws DOMException {
|
||||
return textNode.substringData(offset, count);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void appendData(String arg) throws DOMException {
|
||||
textNode.appendData(arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void insertData(int offset, String arg) throws DOMException {
|
||||
textNode.insertData(offset, arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteData(int offset, int count) throws DOMException {
|
||||
textNode.deleteData(offset, count);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void replaceData(int offset, int count, String arg) throws DOMException {
|
||||
textNode.replaceData(offset, count, arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNodeName() {
|
||||
return textNode.getNodeName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNodeValue() throws DOMException {
|
||||
return textNode.getNodeValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setNodeValue(String nodeValue) throws DOMException {
|
||||
textNode.setNodeValue(nodeValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public short getNodeType() {
|
||||
return textNode.getNodeType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Node getParentNode() {
|
||||
return textNode.getParentNode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public NodeList getChildNodes() {
|
||||
return textNode.getChildNodes();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Node getFirstChild() {
|
||||
return textNode.getFirstChild();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Node getLastChild() {
|
||||
return textNode.getLastChild();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Node getPreviousSibling() {
|
||||
return textNode.getPreviousSibling();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Node getNextSibling() {
|
||||
return textNode.getNextSibling();
|
||||
}
|
||||
|
||||
@Override
|
||||
public NamedNodeMap getAttributes() {
|
||||
return textNode.getAttributes();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Document getOwnerDocument() {
|
||||
return textNode.getOwnerDocument();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Node insertBefore(Node newChild, Node refChild) throws DOMException {
|
||||
return textNode.insertBefore(newChild, refChild);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Node replaceChild(Node newChild, Node oldChild) throws DOMException {
|
||||
return textNode.replaceChild(newChild, oldChild);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Node removeChild(Node oldChild) throws DOMException {
|
||||
return textNode.removeChild(oldChild);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Node appendChild(Node newChild) throws DOMException {
|
||||
return textNode.appendChild(newChild);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasChildNodes() {
|
||||
return textNode.hasChildNodes();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Node cloneNode(boolean deep) {
|
||||
return textNode.cloneNode(deep);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void normalize() {
|
||||
textNode.normalize();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSupported(String feature, String version) {
|
||||
return textNode.isSupported(feature, version);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNamespaceURI() {
|
||||
return textNode.getNamespaceURI();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPrefix() {
|
||||
return textNode.getPrefix();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPrefix(String prefix) throws DOMException {
|
||||
textNode.setPrefix(prefix);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLocalName() {
|
||||
return textNode.getLocalName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasAttributes() {
|
||||
return textNode.hasAttributes();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBaseURI() {
|
||||
return textNode.getBaseURI();
|
||||
}
|
||||
|
||||
@Override
|
||||
public short compareDocumentPosition(Node other) throws DOMException {
|
||||
return textNode.compareDocumentPosition(other);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextContent() throws DOMException {
|
||||
return textNode.getTextContent();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTextContent(String textContent) throws DOMException {
|
||||
textNode.setTextContent(textContent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSameNode(Node other) {
|
||||
return textNode.isSameNode(other);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String lookupPrefix(String namespaceURI) {
|
||||
return textNode.lookupPrefix(namespaceURI);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDefaultNamespace(String namespaceURI) {
|
||||
return textNode.isDefaultNamespace(namespaceURI);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String lookupNamespaceURI(String prefix) {
|
||||
return textNode.lookupNamespaceURI(prefix);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEqualNode(Node arg) {
|
||||
return textNode.isEqualNode(arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getFeature(String feature, String version) {
|
||||
return textNode.getFeature(feature, version);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object setUserData(String key, Object data, UserDataHandler handler) {
|
||||
return textNode.setUserData(key, data, handler);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getUserData(String key) {
|
||||
return textNode.getUserData(key);
|
||||
}
|
||||
|
||||
protected static final Logger log =
|
||||
Logger.getLogger(LogDomainConstants.SOAP_IMPL_DOMAIN,
|
||||
"com.sun.xml.internal.messaging.saaj.soap.impl.LocalStrings");
|
||||
|
||||
private Text textNode;
|
||||
|
||||
public SOAPTextImpl(SOAPDocumentImpl ownerDoc, String text) {
|
||||
textNode = ownerDoc.getDomDocument().createTextNode(text);
|
||||
ownerDoc.register(this);
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
String nodeValue = getNodeValue();
|
||||
return (nodeValue.equals("") ? null : nodeValue);
|
||||
}
|
||||
|
||||
public void setValue(String text) {
|
||||
setNodeValue(text);
|
||||
}
|
||||
|
||||
public void setParentElement(SOAPElement parent) throws SOAPException {
|
||||
if (parent == null) {
|
||||
log.severe("SAAJ0126.impl.cannot.locate.ns");
|
||||
throw new SOAPException("Cannot pass NULL to setParentElement");
|
||||
}
|
||||
((ElementImpl) parent).addNode(this);
|
||||
}
|
||||
|
||||
public SOAPElement getParentElement() {
|
||||
return (SOAPElement) getParentNode();
|
||||
}
|
||||
|
||||
|
||||
public void detachNode() {
|
||||
org.w3c.dom.Node parent = getParentNode();
|
||||
if (parent != null) {
|
||||
parent.removeChild(getDomElement());
|
||||
}
|
||||
}
|
||||
|
||||
public void recycleNode() {
|
||||
detachNode();
|
||||
// TBD
|
||||
// - add this to the factory so subsequent
|
||||
// creations can reuse this object.
|
||||
}
|
||||
|
||||
public boolean isComment() {
|
||||
String txt = getNodeValue();
|
||||
if (txt == null) {
|
||||
@ -343,7 +82,4 @@ public class SOAPTextImpl
|
||||
return txt.startsWith("<!--") && txt.endsWith("-->");
|
||||
}
|
||||
|
||||
public Text getDomElement() {
|
||||
return textNode;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,342 @@
|
||||
/*
|
||||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.xml.internal.messaging.saaj.soap.impl;
|
||||
|
||||
import com.sun.xml.internal.messaging.saaj.soap.SOAPDocumentImpl;
|
||||
import com.sun.xml.internal.messaging.saaj.util.LogDomainConstants;
|
||||
import java.util.logging.Logger;
|
||||
import javax.xml.soap.SOAPElement;
|
||||
import javax.xml.soap.SOAPException;
|
||||
import javax.xml.soap.Text;
|
||||
import org.w3c.dom.CharacterData;
|
||||
import org.w3c.dom.DOMException;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.NamedNodeMap;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
import org.w3c.dom.UserDataHandler;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author lukas
|
||||
* @param <T>
|
||||
*/
|
||||
public abstract class TextImpl<T extends CharacterData> implements Text, CharacterData {
|
||||
|
||||
protected static final Logger log
|
||||
= Logger.getLogger(LogDomainConstants.SOAP_IMPL_DOMAIN,
|
||||
"com.sun.xml.internal.messaging.saaj.soap.impl.LocalStrings");
|
||||
private final T domNode;
|
||||
|
||||
private final SOAPDocumentImpl soapDocument;
|
||||
|
||||
protected TextImpl(SOAPDocumentImpl ownerDoc, String text) {
|
||||
this.soapDocument = ownerDoc;
|
||||
domNode = createN(ownerDoc, text);
|
||||
ownerDoc.register(this);
|
||||
}
|
||||
|
||||
protected TextImpl(SOAPDocumentImpl ownerDoc, CharacterData data) {
|
||||
this.soapDocument = ownerDoc;
|
||||
domNode = createN(ownerDoc, data);
|
||||
ownerDoc.register(this);
|
||||
}
|
||||
|
||||
protected abstract T createN(SOAPDocumentImpl ownerDoc, CharacterData data);
|
||||
|
||||
protected abstract T createN(SOAPDocumentImpl ownerDoc, String text);
|
||||
|
||||
public T getDomElement() {
|
||||
return domNode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getValue() {
|
||||
String nodeValue = getNodeValue();
|
||||
return (nodeValue.equals("") ? null : nodeValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValue(String text) {
|
||||
setNodeValue(text);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setParentElement(SOAPElement parent) throws SOAPException {
|
||||
if (parent == null) {
|
||||
log.severe("SAAJ0112.impl.no.null.to.parent.elem");
|
||||
throw new SOAPException("Cannot pass NULL to setParentElement");
|
||||
}
|
||||
((ElementImpl) parent).addNode(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SOAPElement getParentElement() {
|
||||
return (SOAPElement) getParentNode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detachNode() {
|
||||
org.w3c.dom.Node parent = getParentNode();
|
||||
if (parent != null) {
|
||||
parent.removeChild(getDomElement());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void recycleNode() {
|
||||
detachNode();
|
||||
// TBD
|
||||
// - add this to the factory so subsequent
|
||||
// creations can reuse this object.
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNodeName() {
|
||||
return domNode.getNodeName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNodeValue() throws DOMException {
|
||||
return domNode.getNodeValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setNodeValue(String nodeValue) throws DOMException {
|
||||
domNode.setNodeValue(nodeValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public short getNodeType() {
|
||||
return domNode.getNodeType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Node getParentNode() {
|
||||
return domNode.getParentNode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public NodeList getChildNodes() {
|
||||
return domNode.getChildNodes();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Node getFirstChild() {
|
||||
return domNode.getFirstChild();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Node getLastChild() {
|
||||
return domNode.getLastChild();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Node getPreviousSibling() {
|
||||
return domNode.getPreviousSibling();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Node getNextSibling() {
|
||||
return domNode.getNextSibling();
|
||||
}
|
||||
|
||||
@Override
|
||||
public NamedNodeMap getAttributes() {
|
||||
return domNode.getAttributes();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Document getOwnerDocument() {
|
||||
return domNode.getOwnerDocument();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Node insertBefore(Node newChild, Node refChild) throws DOMException {
|
||||
return domNode.insertBefore(newChild, refChild);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Node replaceChild(Node newChild, Node oldChild) throws DOMException {
|
||||
return domNode.replaceChild(newChild, oldChild);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Node removeChild(Node oldChild) throws DOMException {
|
||||
return domNode.removeChild(oldChild);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Node appendChild(Node newChild) throws DOMException {
|
||||
return domNode.appendChild(newChild);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasChildNodes() {
|
||||
return domNode.hasChildNodes();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Node cloneNode(boolean deep) {
|
||||
return domNode.cloneNode(deep);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void normalize() {
|
||||
domNode.normalize();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSupported(String feature, String version) {
|
||||
return domNode.isSupported(feature, version);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNamespaceURI() {
|
||||
return domNode.getNamespaceURI();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPrefix() {
|
||||
return domNode.getPrefix();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPrefix(String prefix) throws DOMException {
|
||||
domNode.setPrefix(prefix);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLocalName() {
|
||||
return domNode.getLocalName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasAttributes() {
|
||||
return domNode.hasAttributes();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBaseURI() {
|
||||
return domNode.getBaseURI();
|
||||
}
|
||||
|
||||
@Override
|
||||
public short compareDocumentPosition(Node other) throws DOMException {
|
||||
return domNode.compareDocumentPosition(other);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextContent() throws DOMException {
|
||||
return domNode.getTextContent();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTextContent(String textContent) throws DOMException {
|
||||
domNode.setTextContent(textContent);;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSameNode(Node other) {
|
||||
return domNode.isSameNode(other);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String lookupPrefix(String namespaceURI) {
|
||||
return domNode.lookupPrefix(namespaceURI);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDefaultNamespace(String namespaceURI) {
|
||||
return domNode.isDefaultNamespace(namespaceURI);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String lookupNamespaceURI(String prefix) {
|
||||
return domNode.lookupNamespaceURI(prefix);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEqualNode(Node arg) {
|
||||
return domNode.isEqualNode(arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getFeature(String feature, String version) {
|
||||
return domNode.getFeature(feature, version);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object setUserData(String key, Object data, UserDataHandler handler) {
|
||||
return domNode.setUserData(key, data, handler);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getUserData(String key) {
|
||||
return domNode.getUserData(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getData() throws DOMException {
|
||||
return domNode.getData();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setData(String data) throws DOMException {
|
||||
domNode.setData(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLength() {
|
||||
return domNode.getLength();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String substringData(int offset, int count) throws DOMException {
|
||||
return domNode.substringData(offset, count);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void appendData(String arg) throws DOMException {
|
||||
domNode.appendData(arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void insertData(int offset, String arg) throws DOMException {
|
||||
domNode.insertData(offset, arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteData(int offset, int count) throws DOMException {
|
||||
domNode.deleteData(offset, count);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void replaceData(int offset, int count, String arg) throws DOMException {
|
||||
domNode.replaceData(offset, count, arg);
|
||||
}
|
||||
|
||||
}
|
@ -54,32 +54,38 @@ public class Body1_1Impl extends BodyImpl {
|
||||
throw new UnsupportedOperationException("Not supported in SOAP 1.1");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected NameImpl getFaultName(String name) {
|
||||
// Ignore name
|
||||
return NameImpl.createFault1_1Name(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SOAPBodyElement createBodyElement(Name name) {
|
||||
return new BodyElement1_1Impl(
|
||||
((SOAPDocument) getOwnerDocument()).getDocument(),
|
||||
name);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SOAPBodyElement createBodyElement(QName name) {
|
||||
return new BodyElement1_1Impl(
|
||||
((SOAPDocument) getOwnerDocument()).getDocument(),
|
||||
name);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected QName getDefaultFaultCode() {
|
||||
return new QName(SOAPConstants.URI_NS_SOAP_1_1_ENVELOPE, "Server");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isFault(SOAPElement child) {
|
||||
// SOAP 1.1 faults always use the default name
|
||||
return child.getElementName().equals(getFaultName(null));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SOAPFault createFaultElement() {
|
||||
return new Fault1_1Impl(
|
||||
((SOAPDocument) getOwnerDocument()).getDocument(), getPrefix());
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -36,6 +36,7 @@ import javax.xml.soap.SOAPException;
|
||||
|
||||
import com.sun.xml.internal.messaging.saaj.soap.SOAPDocumentImpl;
|
||||
import com.sun.xml.internal.messaging.saaj.soap.impl.BodyElementImpl;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
public class BodyElement1_1Impl extends BodyElementImpl {
|
||||
|
||||
@ -45,6 +46,12 @@ public class BodyElement1_1Impl extends BodyElementImpl {
|
||||
public BodyElement1_1Impl(SOAPDocumentImpl ownerDoc, QName qname) {
|
||||
super(ownerDoc, qname);
|
||||
}
|
||||
|
||||
public BodyElement1_1Impl(SOAPDocumentImpl ownerDoc, Element domElement) {
|
||||
super(ownerDoc, domElement);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SOAPElement setElementQName(QName newName) throws SOAPException {
|
||||
BodyElementImpl copy =
|
||||
new BodyElement1_1Impl((SOAPDocumentImpl) getOwnerDocument(), newName);
|
||||
|
@ -51,11 +51,13 @@ public class Detail1_1Impl extends DetailImpl {
|
||||
super(ownerDoc, domElement);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected DetailEntry createDetailEntry(Name name) {
|
||||
return new DetailEntry1_1Impl(
|
||||
(SOAPDocumentImpl) getOwnerDocument(),
|
||||
name);
|
||||
}
|
||||
@Override
|
||||
protected DetailEntry createDetailEntry(QName name) {
|
||||
return new DetailEntry1_1Impl(
|
||||
(SOAPDocumentImpl) getOwnerDocument(),
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -36,6 +36,7 @@ import javax.xml.soap.SOAPException;
|
||||
|
||||
import com.sun.xml.internal.messaging.saaj.soap.SOAPDocumentImpl;
|
||||
import com.sun.xml.internal.messaging.saaj.soap.impl.DetailEntryImpl;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
public class DetailEntry1_1Impl extends DetailEntryImpl {
|
||||
|
||||
@ -45,6 +46,12 @@ public class DetailEntry1_1Impl extends DetailEntryImpl {
|
||||
public DetailEntry1_1Impl(SOAPDocumentImpl ownerDoc, QName qname) {
|
||||
super(ownerDoc, qname);
|
||||
}
|
||||
|
||||
public DetailEntry1_1Impl(SOAPDocumentImpl ownerDoc, Element domElement) {
|
||||
super(ownerDoc, domElement);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SOAPElement setElementQName(QName newName) throws SOAPException {
|
||||
DetailEntryImpl copy =
|
||||
new DetailEntry1_1Impl((SOAPDocumentImpl) getOwnerDocument(), newName);
|
||||
|
@ -58,10 +58,12 @@ public class Envelope1_1Impl extends EnvelopeImpl {
|
||||
super(ownerDoc, domElement);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected NameImpl getBodyName(String prefix) {
|
||||
return NameImpl.createBody1_1Name(prefix);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected NameImpl getHeaderName(String prefix) {
|
||||
return NameImpl.createHeader1_1Name(prefix);
|
||||
}
|
||||
|
@ -60,37 +60,48 @@ public class Fault1_1Impl extends FaultImpl {
|
||||
super(ownerDocument, NameImpl.createFault1_1Name(prefix));
|
||||
}
|
||||
|
||||
public Fault1_1Impl(Element domElement, SOAPDocumentImpl ownerDoc) {
|
||||
public Fault1_1Impl(SOAPDocumentImpl ownerDoc, Element domElement) {
|
||||
super(ownerDoc, domElement);
|
||||
}
|
||||
|
||||
public Fault1_1Impl(SOAPDocumentImpl ownerDoc) {
|
||||
super(ownerDoc, NameImpl.createFault1_1Name(null));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected NameImpl getDetailName() {
|
||||
return NameImpl.createDetail1_1Name();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected NameImpl getFaultCodeName() {
|
||||
return NameImpl.createFromUnqualifiedName("faultcode");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected NameImpl getFaultStringName() {
|
||||
return NameImpl.createFromUnqualifiedName("faultstring");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected NameImpl getFaultActorName() {
|
||||
return NameImpl.createFromUnqualifiedName("faultactor");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected DetailImpl createDetail() {
|
||||
return new Detail1_1Impl(
|
||||
((SOAPDocument) getOwnerDocument()).getDocument());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected FaultElementImpl createSOAPFaultElement(String localName) {
|
||||
return new FaultElement1_1Impl(
|
||||
((SOAPDocument) getOwnerDocument()).getDocument(),
|
||||
localName);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void checkIfStandardFaultCode(String faultCode, String uri)
|
||||
throws SOAPException {
|
||||
// SOAP 1.1 doesn't seem to mandate using faultcode from a particular
|
||||
@ -98,16 +109,19 @@ public class Fault1_1Impl extends FaultImpl {
|
||||
// Also need to be backward compatible.
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void finallySetFaultCode(String faultcode) throws SOAPException {
|
||||
this.faultCodeElement.addTextNode(faultcode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFaultCode() {
|
||||
if (this.faultCodeElement == null)
|
||||
findFaultCodeElement();
|
||||
return this.faultCodeElement.getValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Name getFaultCodeAsName() {
|
||||
|
||||
String faultcodeString = getFaultCode();
|
||||
@ -132,6 +146,7 @@ public class Fault1_1Impl extends FaultImpl {
|
||||
return NameImpl.createFromQualifiedName(faultcodeString, nsName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public QName getFaultCodeAsQName() {
|
||||
String faultcodeString = getFaultCode();
|
||||
if (faultcodeString == null) {
|
||||
@ -142,6 +157,7 @@ public class Fault1_1Impl extends FaultImpl {
|
||||
return convertCodeToQName(faultcodeString, this.faultCodeElement);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFaultString(String faultString) throws SOAPException {
|
||||
|
||||
if (this.faultStringElement == null)
|
||||
@ -158,6 +174,7 @@ public class Fault1_1Impl extends FaultImpl {
|
||||
this.faultStringElement.addTextNode(faultString);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFaultString() {
|
||||
if (this.faultStringElement == null)
|
||||
findFaultStringElement();
|
||||
@ -165,6 +182,7 @@ public class Fault1_1Impl extends FaultImpl {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Locale getFaultStringLocale() {
|
||||
if (this.faultStringElement == null)
|
||||
findFaultStringElement();
|
||||
@ -178,6 +196,7 @@ public class Fault1_1Impl extends FaultImpl {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFaultString(String faultString, Locale locale)
|
||||
throws SOAPException {
|
||||
setFaultString(faultString);
|
||||
@ -186,6 +205,7 @@ public class Fault1_1Impl extends FaultImpl {
|
||||
localeToXmlLang(locale));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isStandardFaultElement(String localName) {
|
||||
if (localName.equalsIgnoreCase("detail") ||
|
||||
localName.equalsIgnoreCase("faultcode") ||
|
||||
@ -196,6 +216,7 @@ public class Fault1_1Impl extends FaultImpl {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void appendFaultSubcode(QName subcode) {
|
||||
log.log(
|
||||
Level.SEVERE,
|
||||
@ -204,6 +225,7 @@ public class Fault1_1Impl extends FaultImpl {
|
||||
throw new UnsupportedOperationException("Not supported in SOAP 1.1");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeAllFaultSubcodes() {
|
||||
log.log(
|
||||
Level.SEVERE,
|
||||
@ -212,7 +234,8 @@ public class Fault1_1Impl extends FaultImpl {
|
||||
throw new UnsupportedOperationException("Not supported in SOAP 1.1");
|
||||
}
|
||||
|
||||
public Iterator getFaultSubcodes() {
|
||||
@Override
|
||||
public Iterator<QName> getFaultSubcodes() {
|
||||
log.log(
|
||||
Level.SEVERE,
|
||||
"SAAJ0303.ver1_1.msg.op.unsupported.in.SOAP1.1",
|
||||
@ -220,6 +243,7 @@ public class Fault1_1Impl extends FaultImpl {
|
||||
throw new UnsupportedOperationException("Not supported in SOAP 1.1");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFaultReasonText(Locale locale) {
|
||||
log.log(
|
||||
Level.SEVERE,
|
||||
@ -228,7 +252,8 @@ public class Fault1_1Impl extends FaultImpl {
|
||||
throw new UnsupportedOperationException("Not supported in SOAP 1.1");
|
||||
}
|
||||
|
||||
public Iterator getFaultReasonTexts() {
|
||||
@Override
|
||||
public Iterator<String> getFaultReasonTexts() {
|
||||
log.log(
|
||||
Level.SEVERE,
|
||||
"SAAJ0303.ver1_1.msg.op.unsupported.in.SOAP1.1",
|
||||
@ -236,7 +261,8 @@ public class Fault1_1Impl extends FaultImpl {
|
||||
throw new UnsupportedOperationException("Not supported in SOAP 1.1");
|
||||
}
|
||||
|
||||
public Iterator getFaultReasonLocales() {
|
||||
@Override
|
||||
public Iterator<Locale> getFaultReasonLocales() {
|
||||
log.log(
|
||||
Level.SEVERE,
|
||||
"SAAJ0303.ver1_1.msg.op.unsupported.in.SOAP1.1",
|
||||
@ -244,6 +270,7 @@ public class Fault1_1Impl extends FaultImpl {
|
||||
throw new UnsupportedOperationException("Not supported in SOAP 1.1");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addFaultReasonText(String text, java.util.Locale locale)
|
||||
throws SOAPException {
|
||||
log.log(
|
||||
@ -253,6 +280,7 @@ public class Fault1_1Impl extends FaultImpl {
|
||||
throw new UnsupportedOperationException("Not supported in SOAP 1.1");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFaultRole() {
|
||||
log.log(
|
||||
Level.SEVERE,
|
||||
@ -261,6 +289,7 @@ public class Fault1_1Impl extends FaultImpl {
|
||||
throw new UnsupportedOperationException("Not supported in SOAP 1.1");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFaultRole(String uri) {
|
||||
log.log(
|
||||
Level.SEVERE,
|
||||
@ -269,6 +298,7 @@ public class Fault1_1Impl extends FaultImpl {
|
||||
throw new UnsupportedOperationException("Not supported in SOAP 1.1");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFaultNode() {
|
||||
log.log(
|
||||
Level.SEVERE,
|
||||
@ -277,6 +307,7 @@ public class Fault1_1Impl extends FaultImpl {
|
||||
throw new UnsupportedOperationException("Not supported in SOAP 1.1");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFaultNode(String uri) {
|
||||
log.log(
|
||||
Level.SEVERE,
|
||||
@ -285,10 +316,12 @@ public class Fault1_1Impl extends FaultImpl {
|
||||
throw new UnsupportedOperationException("Not supported in SOAP 1.1");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected QName getDefaultFaultCode() {
|
||||
return new QName(SOAPConstants.URI_NS_SOAP_1_1_ENVELOPE, "Server");
|
||||
}
|
||||
|
||||
@Override
|
||||
public SOAPElement addChildElement(SOAPElement element)
|
||||
throws SOAPException {
|
||||
String localName = element.getLocalName();
|
||||
@ -301,18 +334,21 @@ public class Fault1_1Impl extends FaultImpl {
|
||||
return super.addChildElement(element);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected FaultElementImpl createSOAPFaultElement(QName qname) {
|
||||
return new FaultElement1_1Impl(
|
||||
((SOAPDocument) getOwnerDocument()).getDocument(),
|
||||
qname);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected FaultElementImpl createSOAPFaultElement(Name qname) {
|
||||
return new FaultElement1_1Impl(
|
||||
((SOAPDocument) getOwnerDocument()).getDocument(),
|
||||
(NameImpl)qname);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFaultCode(String faultCode, String prefix, String uri)
|
||||
throws SOAPException {
|
||||
if (prefix == null || "".equals(prefix)) {
|
||||
@ -370,6 +406,7 @@ public class Fault1_1Impl extends FaultImpl {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFaultActor(String faultActor) throws SOAPException {
|
||||
if (this.faultActorElement == null)
|
||||
findFaultActorElement();
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -59,6 +59,7 @@ public class FaultElement1_1Impl extends FaultElementImpl {
|
||||
NameImpl.createFaultElement1_1Name(localName, prefix));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isStandardFaultElement() {
|
||||
String localName = elementQName.getLocalPart();
|
||||
if (localName.equalsIgnoreCase("faultcode") ||
|
||||
@ -69,6 +70,7 @@ public class FaultElement1_1Impl extends FaultElementImpl {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SOAPElement setElementQName(QName newName) throws SOAPException {
|
||||
if (!isStandardFaultElement()) {
|
||||
FaultElement1_1Impl copy =
|
||||
|
@ -56,6 +56,7 @@ public class Header1_1Impl extends HeaderImpl {
|
||||
super(ownerDoc, domElement);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected NameImpl getNotUnderstoodName() {
|
||||
log.log(
|
||||
Level.SEVERE,
|
||||
@ -64,6 +65,7 @@ public class Header1_1Impl extends HeaderImpl {
|
||||
throw new UnsupportedOperationException("Not supported by SOAP 1.1");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected NameImpl getUpgradeName() {
|
||||
return NameImpl.create(
|
||||
"Upgrade",
|
||||
@ -71,6 +73,7 @@ public class Header1_1Impl extends HeaderImpl {
|
||||
SOAPConstants.URI_NS_SOAP_1_1_ENVELOPE);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected NameImpl getSupportedEnvelopeName() {
|
||||
return NameImpl.create(
|
||||
"SupportedEnvelope",
|
||||
@ -78,6 +81,7 @@ public class Header1_1Impl extends HeaderImpl {
|
||||
SOAPConstants.URI_NS_SOAP_1_1_ENVELOPE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SOAPHeaderElement addNotUnderstoodHeaderElement(QName name)
|
||||
throws SOAPException {
|
||||
log.log(
|
||||
@ -87,11 +91,13 @@ public class Header1_1Impl extends HeaderImpl {
|
||||
throw new UnsupportedOperationException("Not supported by SOAP 1.1");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SOAPHeaderElement createHeaderElement(Name name) {
|
||||
return new HeaderElement1_1Impl(
|
||||
((SOAPDocument) getOwnerDocument()).getDocument(),
|
||||
name);
|
||||
}
|
||||
@Override
|
||||
protected SOAPHeaderElement createHeaderElement(QName name) {
|
||||
return new HeaderElement1_1Impl(
|
||||
((SOAPDocument) getOwnerDocument()).getDocument(),
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -41,6 +41,7 @@ import com.sun.xml.internal.messaging.saaj.soap.SOAPDocumentImpl;
|
||||
import com.sun.xml.internal.messaging.saaj.soap.impl.HeaderElementImpl;
|
||||
import com.sun.xml.internal.messaging.saaj.soap.name.NameImpl;
|
||||
import com.sun.xml.internal.messaging.saaj.util.LogDomainConstants;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
public class HeaderElement1_1Impl extends HeaderElementImpl {
|
||||
|
||||
@ -55,17 +56,24 @@ public class HeaderElement1_1Impl extends HeaderElementImpl {
|
||||
super(ownerDoc, qname);
|
||||
}
|
||||
|
||||
public HeaderElement1_1Impl(SOAPDocumentImpl ownerDoc, Element domElement) {
|
||||
super(ownerDoc, domElement);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SOAPElement setElementQName(QName newName) throws SOAPException {
|
||||
HeaderElementImpl copy =
|
||||
new HeaderElement1_1Impl((SOAPDocumentImpl) getOwnerDocument(), newName);
|
||||
return replaceElementWithSOAPElement(this,copy);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected NameImpl getActorAttributeName() {
|
||||
return NameImpl.create("actor", null, NameImpl.SOAP11_NAMESPACE);
|
||||
}
|
||||
|
||||
// role not supported by SOAP 1.1
|
||||
@Override
|
||||
protected NameImpl getRoleAttributeName() {
|
||||
log.log(
|
||||
Level.SEVERE,
|
||||
@ -74,15 +82,18 @@ public class HeaderElement1_1Impl extends HeaderElementImpl {
|
||||
throw new UnsupportedOperationException("Role not supported by SOAP 1.1");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected NameImpl getMustunderstandAttributeName() {
|
||||
return NameImpl.create("mustUnderstand", null, NameImpl.SOAP11_NAMESPACE);
|
||||
}
|
||||
|
||||
// mustUnderstand attribute has literal value "1" or "0"
|
||||
@Override
|
||||
protected String getMustunderstandLiteralValue(boolean mustUnderstand) {
|
||||
return (mustUnderstand == true ? "1" : "0");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean getMustunderstandAttributeValue(String mu) {
|
||||
if ("1".equals(mu) || "true".equalsIgnoreCase(mu))
|
||||
return true;
|
||||
@ -90,6 +101,7 @@ public class HeaderElement1_1Impl extends HeaderElementImpl {
|
||||
}
|
||||
|
||||
// relay not supported by SOAP 1.1
|
||||
@Override
|
||||
protected NameImpl getRelayAttributeName() {
|
||||
log.log(
|
||||
Level.SEVERE,
|
||||
@ -98,6 +110,7 @@ public class HeaderElement1_1Impl extends HeaderElementImpl {
|
||||
throw new UnsupportedOperationException("Relay not supported by SOAP 1.1");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getRelayLiteralValue(boolean relayAttr) {
|
||||
log.log(
|
||||
Level.SEVERE,
|
||||
@ -106,6 +119,7 @@ public class HeaderElement1_1Impl extends HeaderElementImpl {
|
||||
throw new UnsupportedOperationException("Relay not supported by SOAP 1.1");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean getRelayAttributeValue(String mu) {
|
||||
log.log(
|
||||
Level.SEVERE,
|
||||
@ -114,6 +128,7 @@ public class HeaderElement1_1Impl extends HeaderElementImpl {
|
||||
throw new UnsupportedOperationException("Relay not supported by SOAP 1.1");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getActorOrRole() {
|
||||
return getActor();
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -76,6 +76,7 @@ public class Message1_1Impl extends MessageImpl implements SOAPConstants {
|
||||
super(headers,ct,stat,reader);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SOAPPart getSOAPPart() {
|
||||
if (soapPartImpl == null) {
|
||||
soapPartImpl = new SOAPPart1_1Impl(this);
|
||||
@ -83,10 +84,12 @@ public class Message1_1Impl extends MessageImpl implements SOAPConstants {
|
||||
return soapPartImpl;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isCorrectSoapVersion(int contentTypeId) {
|
||||
return (contentTypeId & SOAP1_1_FLAG) != 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAction() {
|
||||
log.log(
|
||||
Level.SEVERE,
|
||||
@ -95,6 +98,7 @@ public class Message1_1Impl extends MessageImpl implements SOAPConstants {
|
||||
throw new UnsupportedOperationException("Operation not supported by SOAP 1.1");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAction(String type) {
|
||||
log.log(
|
||||
Level.SEVERE,
|
||||
@ -103,6 +107,7 @@ public class Message1_1Impl extends MessageImpl implements SOAPConstants {
|
||||
throw new UnsupportedOperationException("Operation not supported by SOAP 1.1");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCharset() {
|
||||
log.log(
|
||||
Level.SEVERE,
|
||||
@ -111,6 +116,7 @@ public class Message1_1Impl extends MessageImpl implements SOAPConstants {
|
||||
throw new UnsupportedOperationException("Operation not supported by SOAP 1.1");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCharset(String charset) {
|
||||
log.log(
|
||||
Level.SEVERE,
|
||||
@ -119,10 +125,12 @@ public class Message1_1Impl extends MessageImpl implements SOAPConstants {
|
||||
throw new UnsupportedOperationException("Operation not supported by SOAP 1.1");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getExpectedContentType() {
|
||||
return isFastInfoset ? "application/fastinfoset" : "text/xml";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getExpectedAcceptHeader() {
|
||||
String accept = "text/xml, text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2";
|
||||
return acceptFastInfoset ? ("application/fastinfoset, " + accept) : accept;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -39,14 +39,17 @@ import com.sun.xml.internal.messaging.saaj.soap.SOAPDocumentImpl;
|
||||
import com.sun.xml.internal.messaging.saaj.soap.SOAPFactoryImpl;
|
||||
|
||||
public class SOAPFactory1_1Impl extends SOAPFactoryImpl {
|
||||
@Override
|
||||
protected SOAPDocumentImpl createDocument() {
|
||||
return (new SOAPPart1_1Impl()).getDocument();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Detail createDetail() throws SOAPException {
|
||||
return new Detail1_1Impl(createDocument());
|
||||
}
|
||||
|
||||
@Override
|
||||
public SOAPFault createFault(String reasonText, QName faultCode)
|
||||
throws SOAPException {
|
||||
if (faultCode == null) {
|
||||
@ -55,14 +58,15 @@ public class SOAPFactory1_1Impl extends SOAPFactoryImpl {
|
||||
if (reasonText == null) {
|
||||
throw new IllegalArgumentException("reasonText argument for createFault was passed NULL");
|
||||
}
|
||||
Fault1_1Impl fault = new Fault1_1Impl(createDocument(), null);
|
||||
Fault1_1Impl fault = new Fault1_1Impl(createDocument());
|
||||
fault.setFaultCode(faultCode);
|
||||
fault.setFaultString(reasonText);
|
||||
return fault;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SOAPFault createFault() throws SOAPException {
|
||||
Fault1_1Impl fault = new Fault1_1Impl(createDocument(), null);
|
||||
Fault1_1Impl fault = new Fault1_1Impl(createDocument());
|
||||
fault.setFaultCode(fault.getDefaultFaultCode());
|
||||
fault.setFaultString("Fault string, and possibly fault code, not set");
|
||||
return fault;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -40,16 +40,19 @@ import com.sun.xml.internal.messaging.saaj.soap.MessageImpl;
|
||||
|
||||
public class SOAPMessageFactory1_1Impl extends MessageFactoryImpl {
|
||||
|
||||
@Override
|
||||
public SOAPMessage createMessage() throws SOAPException {
|
||||
return new Message1_1Impl();
|
||||
}
|
||||
|
||||
@Override
|
||||
public SOAPMessage createMessage(boolean isFastInfoset,
|
||||
boolean acceptFastInfoset) throws SOAPException
|
||||
{
|
||||
return new Message1_1Impl(isFastInfoset, acceptFastInfoset);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SOAPMessage createMessage(MimeHeaders headers, InputStream in) throws IOException, SOAPExceptionImpl {
|
||||
|
||||
if (headers == null) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -54,10 +54,12 @@ public class SOAPPart1_1Impl extends SOAPPartImpl implements SOAPConstants {
|
||||
super(message);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getContentType() {
|
||||
return isFastInfoset() ? "application/fastinfoset" : "text/xml";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Envelope createEnvelopeFromSource() throws SOAPException {
|
||||
// Record the presence of xml declaration before the envelope gets
|
||||
// created.
|
||||
@ -80,11 +82,13 @@ public class SOAPPart1_1Impl extends SOAPPartImpl implements SOAPConstants {
|
||||
return envelope;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Envelope createEmptyEnvelope(String prefix)
|
||||
throws SOAPException {
|
||||
return new Envelope1_1Impl(getDocument(), prefix, true, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SOAPPartImpl duplicateType() {
|
||||
return new SOAPPart1_1Impl();
|
||||
}
|
||||
|
@ -57,25 +57,30 @@ public class Body1_2Impl extends BodyImpl {
|
||||
super(ownerDoc, domElement);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected NameImpl getFaultName(String name) {
|
||||
return NameImpl.createFault1_2Name(name, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SOAPBodyElement createBodyElement(Name name) {
|
||||
return new BodyElement1_2Impl(
|
||||
((SOAPDocument) getOwnerDocument()).getDocument(),
|
||||
name);
|
||||
}
|
||||
@Override
|
||||
protected SOAPBodyElement createBodyElement(QName name) {
|
||||
return new BodyElement1_2Impl(
|
||||
((SOAPDocument) getOwnerDocument()).getDocument(),
|
||||
name);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected QName getDefaultFaultCode() {
|
||||
return SOAPConstants.SOAP_RECEIVER_FAULT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SOAPFault addFault() throws SOAPException {
|
||||
if (hasAnyChildElement()) {
|
||||
log.severe("SAAJ0402.ver1_2.only.fault.allowed.in.body");
|
||||
@ -89,6 +94,7 @@ public class Body1_2Impl extends BodyImpl {
|
||||
* Override setEncodingStyle of ElementImpl to restrict adding encodingStyle
|
||||
* attribute to SOAP Body (SOAP 1.2 spec, part 1, section 5.1.1)
|
||||
*/
|
||||
@Override
|
||||
public void setEncodingStyle(String encodingStyle) throws SOAPException {
|
||||
log.severe("SAAJ0401.ver1_2.no.encodingstyle.in.body");
|
||||
throw new SOAPExceptionImpl("encodingStyle attribute cannot appear on Body");
|
||||
@ -98,6 +104,7 @@ public class Body1_2Impl extends BodyImpl {
|
||||
* Override addAttribute of ElementImpl to restrict adding encodingStyle
|
||||
* attribute to SOAP Body (SOAP 1.2 spec, part 1, section 5.1.1)
|
||||
*/
|
||||
@Override
|
||||
public SOAPElement addAttribute(Name name, String value)
|
||||
throws SOAPException {
|
||||
if (name.getLocalName().equals("encodingStyle")
|
||||
@ -108,6 +115,7 @@ public class Body1_2Impl extends BodyImpl {
|
||||
return super.addAttribute(name, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SOAPElement addAttribute(QName name, String value)
|
||||
throws SOAPException {
|
||||
if (name.getLocalPart().equals("encodingStyle")
|
||||
@ -118,6 +126,7 @@ public class Body1_2Impl extends BodyImpl {
|
||||
return super.addAttribute(name, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isFault(SOAPElement child) {
|
||||
return (child.getElementName().getURI().equals(
|
||||
SOAPConstants.URI_NS_SOAP_1_2_ENVELOPE) &&
|
||||
@ -125,6 +134,7 @@ public class Body1_2Impl extends BodyImpl {
|
||||
"Fault"));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SOAPFault createFaultElement() {
|
||||
return new Fault1_2Impl(
|
||||
((SOAPDocument) getOwnerDocument()).getDocument(), getPrefix());
|
||||
@ -135,6 +145,7 @@ public class Body1_2Impl extends BodyImpl {
|
||||
* SOAP message MUST contain a single Fault element as the only
|
||||
* child element of the SOAP Body.
|
||||
*/
|
||||
@Override
|
||||
public SOAPBodyElement addBodyElement(Name name) throws SOAPException {
|
||||
if (hasFault()) {
|
||||
log.severe("SAAJ0402.ver1_2.only.fault.allowed.in.body");
|
||||
@ -144,6 +155,7 @@ public class Body1_2Impl extends BodyImpl {
|
||||
return super.addBodyElement(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SOAPBodyElement addBodyElement(QName name) throws SOAPException {
|
||||
if (hasFault()) {
|
||||
log.severe("SAAJ0402.ver1_2.only.fault.allowed.in.body");
|
||||
@ -153,6 +165,7 @@ public class Body1_2Impl extends BodyImpl {
|
||||
return super.addBodyElement(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SOAPElement addElement(Name name) throws SOAPException {
|
||||
if (hasFault()) {
|
||||
log.severe("SAAJ0402.ver1_2.only.fault.allowed.in.body");
|
||||
@ -162,6 +175,7 @@ public class Body1_2Impl extends BodyImpl {
|
||||
return super.addElement(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SOAPElement addElement(QName name) throws SOAPException {
|
||||
if (hasFault()) {
|
||||
log.severe("SAAJ0402.ver1_2.only.fault.allowed.in.body");
|
||||
@ -171,6 +185,7 @@ public class Body1_2Impl extends BodyImpl {
|
||||
return super.addElement(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SOAPElement addChildElement(Name name) throws SOAPException {
|
||||
if (hasFault()) {
|
||||
log.severe("SAAJ0402.ver1_2.only.fault.allowed.in.body");
|
||||
@ -180,6 +195,7 @@ public class Body1_2Impl extends BodyImpl {
|
||||
return super.addChildElement(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SOAPElement addChildElement(QName name) throws SOAPException {
|
||||
if (hasFault()) {
|
||||
log.severe("SAAJ0402.ver1_2.only.fault.allowed.in.body");
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -36,6 +36,7 @@ import javax.xml.soap.SOAPElement;
|
||||
|
||||
import com.sun.xml.internal.messaging.saaj.soap.SOAPDocumentImpl;
|
||||
import com.sun.xml.internal.messaging.saaj.soap.impl.BodyElementImpl;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
public class BodyElement1_2Impl extends BodyElementImpl {
|
||||
|
||||
@ -47,6 +48,11 @@ public class BodyElement1_2Impl extends BodyElementImpl {
|
||||
super(ownerDoc, qname);
|
||||
}
|
||||
|
||||
public BodyElement1_2Impl(SOAPDocumentImpl ownerDoc, Element domElement) {
|
||||
super(ownerDoc, domElement);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SOAPElement setElementQName(QName newName) throws SOAPException {
|
||||
BodyElementImpl copy =
|
||||
new BodyElement1_2Impl((SOAPDocumentImpl) getOwnerDocument(), newName);
|
||||
|
@ -59,12 +59,14 @@ public class Detail1_2Impl extends DetailImpl {
|
||||
super(ownerDoc, domElement);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected DetailEntry createDetailEntry(Name name) {
|
||||
return new DetailEntry1_2Impl(
|
||||
((SOAPDocument) getOwnerDocument()).getDocument(),
|
||||
name);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected DetailEntry createDetailEntry(QName name) {
|
||||
return new DetailEntry1_2Impl(
|
||||
((SOAPDocument) getOwnerDocument()).getDocument(),
|
||||
@ -75,11 +77,13 @@ public class Detail1_2Impl extends DetailImpl {
|
||||
* Override setEncodingStyle of ElementImpl to restrict adding encodingStyle
|
||||
* attribute to SOAP Detail (SOAP 1.2 spec, part 1, section 5.1.1)
|
||||
*/
|
||||
@Override
|
||||
public void setEncodingStyle(String encodingStyle) throws SOAPException {
|
||||
log.severe("SAAJ0403.ver1_2.no.encodingStyle.in.detail");
|
||||
throw new SOAPExceptionImpl("EncodingStyle attribute cannot appear in Detail");
|
||||
}
|
||||
|
||||
@Override
|
||||
public SOAPElement addAttribute(Name name, String value)
|
||||
throws SOAPException {
|
||||
if (name.getLocalName().equals("encodingStyle")
|
||||
@ -89,6 +93,7 @@ public class Detail1_2Impl extends DetailImpl {
|
||||
return super.addAttribute(name, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SOAPElement addAttribute(QName name, String value)
|
||||
throws SOAPException {
|
||||
if (name.getLocalPart().equals("encodingStyle")
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -36,6 +36,7 @@ import javax.xml.soap.SOAPElement;
|
||||
|
||||
import com.sun.xml.internal.messaging.saaj.soap.SOAPDocumentImpl;
|
||||
import com.sun.xml.internal.messaging.saaj.soap.impl.DetailEntryImpl;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
public class DetailEntry1_2Impl extends DetailEntryImpl {
|
||||
|
||||
@ -47,6 +48,11 @@ public class DetailEntry1_2Impl extends DetailEntryImpl {
|
||||
super(ownerDoc, qname);
|
||||
}
|
||||
|
||||
public DetailEntry1_2Impl(SOAPDocumentImpl ownerDoc, Element domElement) {
|
||||
super(ownerDoc, domElement);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SOAPElement setElementQName(QName newName) throws SOAPException {
|
||||
DetailEntryImpl copy =
|
||||
new DetailEntry1_2Impl((SOAPDocumentImpl) getOwnerDocument(), newName);
|
||||
|
@ -68,10 +68,12 @@ public class Envelope1_2Impl extends EnvelopeImpl {
|
||||
createBody);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected NameImpl getBodyName(String prefix) {
|
||||
return NameImpl.createBody1_2Name(prefix);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected NameImpl getHeaderName(String prefix) {
|
||||
return NameImpl.createHeader1_2Name(prefix);
|
||||
}
|
||||
@ -80,6 +82,7 @@ public class Envelope1_2Impl extends EnvelopeImpl {
|
||||
* Override setEncodingStyle of ElementImpl to restrict adding encodingStyle
|
||||
* attribute to SOAP Envelope (SOAP 1.2 spec, part 1, section 5.1.1)
|
||||
*/
|
||||
@Override
|
||||
public void setEncodingStyle(String encodingStyle) throws SOAPException {
|
||||
log.severe("SAAJ0404.ver1_2.no.encodingStyle.in.envelope");
|
||||
throw new SOAPExceptionImpl("encodingStyle attribute cannot appear on Envelope");
|
||||
@ -89,6 +92,7 @@ public class Envelope1_2Impl extends EnvelopeImpl {
|
||||
* Override addAttribute of ElementImpl to restrict adding encodingStyle
|
||||
* attribute to SOAP Envelope (SOAP 1.2 spec, part 1, section 5.1.1)
|
||||
*/
|
||||
@Override
|
||||
public SOAPElement addAttribute(Name name, String value)
|
||||
throws SOAPException {
|
||||
if (name.getLocalName().equals("encodingStyle")
|
||||
@ -98,6 +102,7 @@ public class Envelope1_2Impl extends EnvelopeImpl {
|
||||
return super.addAttribute(name, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SOAPElement addAttribute(QName name, String value)
|
||||
throws SOAPException {
|
||||
if (name.getLocalPart().equals("encodingStyle")
|
||||
@ -112,6 +117,7 @@ public class Envelope1_2Impl extends EnvelopeImpl {
|
||||
* Override addChildElement method to ensure that no element
|
||||
* is added after body in SOAP 1.2.
|
||||
*/
|
||||
@Override
|
||||
public SOAPElement addChildElement(Name name) throws SOAPException {
|
||||
// check if body already exists
|
||||
if (getBody() != null) {
|
||||
@ -122,6 +128,7 @@ public class Envelope1_2Impl extends EnvelopeImpl {
|
||||
return super.addChildElement(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SOAPElement addChildElement(QName name) throws SOAPException {
|
||||
// check if body already exists
|
||||
if (getBody() != null) {
|
||||
@ -142,6 +149,7 @@ public class Envelope1_2Impl extends EnvelopeImpl {
|
||||
*
|
||||
*/
|
||||
|
||||
@Override
|
||||
public SOAPElement addTextNode(String text) throws SOAPException {
|
||||
log.log(
|
||||
Level.SEVERE,
|
||||
|
@ -29,12 +29,10 @@
|
||||
*/
|
||||
package com.sun.xml.internal.messaging.saaj.soap.ver1_2;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.logging.Logger;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import javax.xml.namespace.QName;
|
||||
import javax.xml.soap.*;
|
||||
|
||||
import com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl;
|
||||
import com.sun.xml.internal.messaging.saaj.soap.SOAPDocument;
|
||||
@ -42,6 +40,14 @@ import com.sun.xml.internal.messaging.saaj.soap.SOAPDocumentImpl;
|
||||
import com.sun.xml.internal.messaging.saaj.soap.impl.*;
|
||||
import com.sun.xml.internal.messaging.saaj.soap.name.NameImpl;
|
||||
import com.sun.xml.internal.messaging.saaj.util.LogDomainConstants;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import javax.xml.soap.Name;
|
||||
import javax.xml.soap.SOAPConstants;
|
||||
import javax.xml.soap.SOAPElement;
|
||||
import javax.xml.soap.SOAPException;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
|
||||
@ -69,22 +75,30 @@ public class Fault1_2Impl extends FaultImpl {
|
||||
super(ownerDocument, NameImpl.createFault1_2Name(null, prefix));
|
||||
}
|
||||
|
||||
public Fault1_2Impl(Element domElement, SOAPDocumentImpl ownerDoc) {
|
||||
public Fault1_2Impl(SOAPDocumentImpl ownerDocument) {
|
||||
super(ownerDocument, NameImpl.createFault1_2Name(null, null));
|
||||
}
|
||||
|
||||
public Fault1_2Impl(SOAPDocumentImpl ownerDoc, Element domElement) {
|
||||
super(ownerDoc, domElement);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected NameImpl getDetailName() {
|
||||
return NameImpl.createSOAP12Name("Detail", getPrefix());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected NameImpl getFaultCodeName() {
|
||||
return NameImpl.createSOAP12Name("Code", getPrefix());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected NameImpl getFaultStringName() {
|
||||
return getFaultReasonName();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected NameImpl getFaultActorName() {
|
||||
return getFaultRoleName();
|
||||
}
|
||||
@ -109,17 +123,20 @@ public class Fault1_2Impl extends FaultImpl {
|
||||
return NameImpl.createXmlName("lang");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected DetailImpl createDetail() {
|
||||
return new Detail1_2Impl(
|
||||
((SOAPDocument) getOwnerDocument()).getDocument());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected FaultElementImpl createSOAPFaultElement(String localName) {
|
||||
return new FaultElement1_2Impl(
|
||||
((SOAPDocument) getOwnerDocument()).getDocument(),
|
||||
localName);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void checkIfStandardFaultCode(String faultCode, String uri)
|
||||
throws SOAPException {
|
||||
QName qname = new QName(uri, faultCode);
|
||||
@ -136,6 +153,7 @@ public class Fault1_2Impl extends FaultImpl {
|
||||
throw new SOAPExceptionImpl(qname + " is not a standard Code value");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void finallySetFaultCode(String faultcode) throws SOAPException {
|
||||
SOAPElement value = this.faultCodeElement.addChildElement(valueName);
|
||||
value.addTextNode(faultcode);
|
||||
@ -145,13 +163,14 @@ public class Fault1_2Impl extends FaultImpl {
|
||||
findFaultStringElement();
|
||||
}
|
||||
|
||||
public Iterator getFaultReasonTexts() throws SOAPException {
|
||||
@Override
|
||||
public Iterator<String> getFaultReasonTexts() throws SOAPException {
|
||||
// Fault Reason has similar semantics as faultstring
|
||||
if (this.faultStringElement == null)
|
||||
findReasonElement();
|
||||
Iterator eachTextElement =
|
||||
this.faultStringElement.getChildElements(textName);
|
||||
List<String> texts = new ArrayList<String>();
|
||||
List<String> texts = new ArrayList<>();
|
||||
while (eachTextElement.hasNext()) {
|
||||
SOAPElement textElement = (SOAPElement) eachTextElement.next();
|
||||
Locale thisLocale = getLocale(textElement);
|
||||
@ -168,6 +187,7 @@ public class Fault1_2Impl extends FaultImpl {
|
||||
return texts.iterator();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addFaultReasonText(String text, java.util.Locale locale)
|
||||
throws SOAPException {
|
||||
|
||||
@ -214,6 +234,7 @@ public class Fault1_2Impl extends FaultImpl {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFaultReasonText(Locale locale) throws SOAPException {
|
||||
|
||||
if (locale == null)
|
||||
@ -234,13 +255,14 @@ public class Fault1_2Impl extends FaultImpl {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Iterator getFaultReasonLocales() throws SOAPException {
|
||||
@Override
|
||||
public Iterator<Locale> getFaultReasonLocales() throws SOAPException {
|
||||
// Fault Reason has similar semantics as faultstring
|
||||
if (this.faultStringElement == null)
|
||||
findReasonElement();
|
||||
Iterator eachTextElement =
|
||||
this.faultStringElement.getChildElements(textName);
|
||||
List<Locale> localeSet = new ArrayList<Locale>();
|
||||
List<Locale> localeSet = new ArrayList<>();
|
||||
while (eachTextElement.hasNext()) {
|
||||
SOAPElement textElement = (SOAPElement) eachTextElement.next();
|
||||
Locale thisLocale = getLocale(textElement);
|
||||
@ -257,6 +279,7 @@ public class Fault1_2Impl extends FaultImpl {
|
||||
return localeSet.iterator();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Locale getFaultStringLocale() {
|
||||
Locale locale = null;
|
||||
try {
|
||||
@ -288,6 +311,7 @@ public class Fault1_2Impl extends FaultImpl {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFaultNode() {
|
||||
SOAPElement faultNode = findAndConvertChildElement(getFaultNodeName());
|
||||
if (faultNode == null) {
|
||||
@ -296,6 +320,7 @@ public class Fault1_2Impl extends FaultImpl {
|
||||
return faultNode.getValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFaultNode(String uri) throws SOAPException {
|
||||
SOAPElement faultNode = findAndConvertChildElement(getFaultNodeName());
|
||||
if (faultNode != null) {
|
||||
@ -314,10 +339,12 @@ public class Fault1_2Impl extends FaultImpl {
|
||||
addNode(faultNode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFaultRole() {
|
||||
return getFaultActor();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFaultRole(String uri) throws SOAPException {
|
||||
if (this.faultActorElement == null)
|
||||
findFaultActorElement();
|
||||
@ -333,6 +360,7 @@ public class Fault1_2Impl extends FaultImpl {
|
||||
addNode(this.faultActorElement);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFaultCode() {
|
||||
if (this.faultCodeElement == null)
|
||||
findFaultCodeElement();
|
||||
@ -341,6 +369,7 @@ public class Fault1_2Impl extends FaultImpl {
|
||||
return ((SOAPElement) codeValues.next()).getValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public QName getFaultCodeAsQName() {
|
||||
String faultcode = getFaultCode();
|
||||
if (faultcode == null) {
|
||||
@ -355,6 +384,7 @@ public class Fault1_2Impl extends FaultImpl {
|
||||
(SOAPElement) valueElements.next());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Name getFaultCodeAsName() {
|
||||
String faultcode = getFaultCode();
|
||||
if (faultcode == null) {
|
||||
@ -370,6 +400,7 @@ public class Fault1_2Impl extends FaultImpl {
|
||||
(SOAPElement) valueElements.next()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFaultString() {
|
||||
String reason = null;
|
||||
try {
|
||||
@ -380,10 +411,12 @@ public class Fault1_2Impl extends FaultImpl {
|
||||
return reason;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFaultString(String faultString) throws SOAPException {
|
||||
addFaultReasonText(faultString, Locale.getDefault());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFaultString(
|
||||
String faultString,
|
||||
Locale locale)
|
||||
@ -391,6 +424,7 @@ public class Fault1_2Impl extends FaultImpl {
|
||||
addFaultReasonText(faultString, locale);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void appendFaultSubcode(QName subcode) throws SOAPException {
|
||||
if (subcode == null) {
|
||||
return;
|
||||
@ -426,6 +460,7 @@ public class Fault1_2Impl extends FaultImpl {
|
||||
subcodeValueElement.addTextNode(prefix + ":" + subcode.getLocalPart());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeAllFaultSubcodes() {
|
||||
if (this.faultCodeElement == null)
|
||||
findFaultCodeElement();
|
||||
@ -437,10 +472,11 @@ public class Fault1_2Impl extends FaultImpl {
|
||||
}
|
||||
}
|
||||
|
||||
public Iterator getFaultSubcodes() {
|
||||
@Override
|
||||
public Iterator<QName> getFaultSubcodes() {
|
||||
if (this.faultCodeElement == null)
|
||||
findFaultCodeElement();
|
||||
final List<QName> subcodeList = new ArrayList<QName>();
|
||||
final List<QName> subcodeList = new ArrayList<>();
|
||||
SOAPElement currentCodeElement = this.faultCodeElement;
|
||||
Iterator subcodeElements =
|
||||
currentCodeElement.getChildElements(subcodeName);
|
||||
@ -457,14 +493,17 @@ public class Fault1_2Impl extends FaultImpl {
|
||||
return new Iterator<QName>() {
|
||||
Iterator<QName> subCodeIter = subcodeList.iterator();
|
||||
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
return subCodeIter.hasNext();
|
||||
}
|
||||
|
||||
@Override
|
||||
public QName next() {
|
||||
return subCodeIter.next();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
throw new UnsupportedOperationException(
|
||||
"Method remove() not supported on SubCodes Iterator");
|
||||
@ -480,11 +519,13 @@ public class Fault1_2Impl extends FaultImpl {
|
||||
* Override setEncodingStyle of ElementImpl to restrict adding encodingStyle
|
||||
* attribute to SOAP Fault (SOAP 1.2 spec, part 1, section 5.1.1)
|
||||
*/
|
||||
@Override
|
||||
public void setEncodingStyle(String encodingStyle) throws SOAPException {
|
||||
log.severe("SAAJ0407.ver1_2.no.encodingStyle.in.fault");
|
||||
throw new SOAPExceptionImpl("encodingStyle attribute cannot appear on Fault");
|
||||
}
|
||||
|
||||
@Override
|
||||
public SOAPElement addAttribute(Name name, String value)
|
||||
throws SOAPException {
|
||||
if (name.getLocalName().equals("encodingStyle")
|
||||
@ -494,6 +535,7 @@ public class Fault1_2Impl extends FaultImpl {
|
||||
return super.addAttribute(name, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SOAPElement addAttribute(QName name, String value)
|
||||
throws SOAPException {
|
||||
if (name.getLocalPart().equals("encodingStyle")
|
||||
@ -503,6 +545,7 @@ public class Fault1_2Impl extends FaultImpl {
|
||||
return super.addAttribute(name, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SOAPElement addTextNode(String text) throws SOAPException {
|
||||
log.log(
|
||||
Level.SEVERE,
|
||||
@ -511,6 +554,7 @@ public class Fault1_2Impl extends FaultImpl {
|
||||
throw new SOAPExceptionImpl("Adding text to SOAP 1.2 Fault is not legal");
|
||||
}
|
||||
|
||||
@Override
|
||||
public SOAPElement addChildElement(SOAPElement element)
|
||||
throws SOAPException {
|
||||
String localName = element.getLocalName();
|
||||
@ -533,6 +577,7 @@ public class Fault1_2Impl extends FaultImpl {
|
||||
return super.addChildElement(element);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isStandardFaultElement(String localName) {
|
||||
if (localName.equalsIgnoreCase("code") ||
|
||||
localName.equalsIgnoreCase("reason") ||
|
||||
@ -544,22 +589,26 @@ public class Fault1_2Impl extends FaultImpl {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected QName getDefaultFaultCode() {
|
||||
return SOAPConstants.SOAP_SENDER_FAULT;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected FaultElementImpl createSOAPFaultElement(QName qname) {
|
||||
return new FaultElement1_2Impl(
|
||||
((SOAPDocument) getOwnerDocument()).getDocument(),
|
||||
qname);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected FaultElementImpl createSOAPFaultElement(Name qname) {
|
||||
return new FaultElement1_2Impl(
|
||||
((SOAPDocument) getOwnerDocument()).getDocument(),
|
||||
(NameImpl)qname);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFaultActor(String faultActor) throws SOAPException {
|
||||
this.setFaultRole(faultActor);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -38,6 +38,7 @@ import com.sun.xml.internal.messaging.saaj.soap.SOAPDocumentImpl;
|
||||
import com.sun.xml.internal.messaging.saaj.soap.impl.FaultElementImpl;
|
||||
import com.sun.xml.internal.messaging.saaj.soap.name.NameImpl;
|
||||
import com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
public class FaultElement1_2Impl extends FaultElementImpl {
|
||||
|
||||
@ -53,6 +54,11 @@ public class FaultElement1_2Impl extends FaultElementImpl {
|
||||
super(ownerDoc, NameImpl.createSOAP12Name(localName));
|
||||
}
|
||||
|
||||
public FaultElement1_2Impl(SOAPDocumentImpl ownerDoc, Element domElement) {
|
||||
super(ownerDoc, domElement);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isStandardFaultElement() {
|
||||
String localName = elementQName.getLocalPart();
|
||||
if (localName.equalsIgnoreCase("code") ||
|
||||
@ -64,6 +70,7 @@ public class FaultElement1_2Impl extends FaultElementImpl {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SOAPElement setElementQName(QName newName) throws SOAPException {
|
||||
if (!isStandardFaultElement()) {
|
||||
FaultElement1_2Impl copy =
|
||||
@ -74,11 +81,13 @@ public class FaultElement1_2Impl extends FaultElementImpl {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEncodingStyle(String encodingStyle) throws SOAPException {
|
||||
log.severe("SAAJ0408.ver1_2.no.encodingStyle.in.fault.child");
|
||||
throw new SOAPExceptionImpl("encodingStyle attribute cannot appear on a Fault child element");
|
||||
}
|
||||
|
||||
@Override
|
||||
public SOAPElement addAttribute(Name name, String value)
|
||||
throws SOAPException {
|
||||
if (name.getLocalName().equals("encodingStyle")
|
||||
@ -88,6 +97,7 @@ public class FaultElement1_2Impl extends FaultElementImpl {
|
||||
return super.addAttribute(name, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SOAPElement addAttribute(QName name, String value)
|
||||
throws SOAPException {
|
||||
if (name.getLocalPart().equals("encodingStyle")
|
||||
|
@ -59,18 +59,22 @@ public class Header1_2Impl extends HeaderImpl {
|
||||
super(ownerDoc, domElement);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected NameImpl getNotUnderstoodName() {
|
||||
return NameImpl.createNotUnderstood1_2Name(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected NameImpl getUpgradeName() {
|
||||
return NameImpl.createUpgrade1_2Name(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected NameImpl getSupportedEnvelopeName() {
|
||||
return NameImpl.createSupportedEnvelope1_2Name(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SOAPHeaderElement addNotUnderstoodHeaderElement(final QName sourceName)
|
||||
throws SOAPException {
|
||||
|
||||
@ -102,6 +106,7 @@ public class Header1_2Impl extends HeaderImpl {
|
||||
return notunderstoodHeaderElement;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SOAPElement addTextNode(String text) throws SOAPException {
|
||||
log.log(
|
||||
Level.SEVERE,
|
||||
@ -110,6 +115,7 @@ public class Header1_2Impl extends HeaderImpl {
|
||||
throw new SOAPExceptionImpl("Adding text to SOAP 1.2 Header is not legal");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SOAPHeaderElement createHeaderElement(Name name)
|
||||
throws SOAPException {
|
||||
String uri = name.getURI();
|
||||
@ -122,6 +128,7 @@ public class Header1_2Impl extends HeaderImpl {
|
||||
name);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SOAPHeaderElement createHeaderElement(QName name)
|
||||
throws SOAPException {
|
||||
String uri = name.getNamespaceURI();
|
||||
@ -134,11 +141,13 @@ public class Header1_2Impl extends HeaderImpl {
|
||||
name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEncodingStyle(String encodingStyle) throws SOAPException {
|
||||
log.severe("SAAJ0409.ver1_2.no.encodingstyle.in.header");
|
||||
throw new SOAPExceptionImpl("encodingStyle attribute cannot appear on Header");
|
||||
}
|
||||
|
||||
@Override
|
||||
public SOAPElement addAttribute(Name name, String value)
|
||||
throws SOAPException {
|
||||
if (name.getLocalName().equals("encodingStyle")
|
||||
@ -149,6 +158,7 @@ public class Header1_2Impl extends HeaderImpl {
|
||||
return super.addAttribute(name, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SOAPElement addAttribute(QName name, String value)
|
||||
throws SOAPException {
|
||||
if (name.getLocalPart().equals("encodingStyle")
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -37,6 +37,7 @@ import javax.xml.soap.SOAPException;
|
||||
import com.sun.xml.internal.messaging.saaj.soap.SOAPDocumentImpl;
|
||||
import com.sun.xml.internal.messaging.saaj.soap.impl.HeaderElementImpl;
|
||||
import com.sun.xml.internal.messaging.saaj.soap.name.NameImpl;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
public class HeaderElement1_2Impl extends HeaderElementImpl {
|
||||
|
||||
@ -47,51 +48,65 @@ public class HeaderElement1_2Impl extends HeaderElementImpl {
|
||||
super(ownerDoc, qname);
|
||||
}
|
||||
|
||||
public HeaderElement1_2Impl(SOAPDocumentImpl ownerDoc, Element domElement) {
|
||||
super(ownerDoc, domElement);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SOAPElement setElementQName(QName newName) throws SOAPException {
|
||||
HeaderElementImpl copy =
|
||||
new HeaderElement1_2Impl((SOAPDocumentImpl)getOwnerDocument(), newName);
|
||||
return replaceElementWithSOAPElement(this,copy);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected NameImpl getRoleAttributeName() {
|
||||
return NameImpl.create("role", null, NameImpl.SOAP12_NAMESPACE);
|
||||
}
|
||||
|
||||
// Actor equivalent to Role in SOAP 1.2
|
||||
@Override
|
||||
protected NameImpl getActorAttributeName() {
|
||||
return getRoleAttributeName();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected NameImpl getMustunderstandAttributeName() {
|
||||
return NameImpl.create("mustUnderstand", null, NameImpl.SOAP12_NAMESPACE);
|
||||
}
|
||||
|
||||
// mustUnderstand attribute has literal value "true" or "false"
|
||||
@Override
|
||||
protected String getMustunderstandLiteralValue(boolean mustUnderstand) {
|
||||
return (mustUnderstand == true ? "true" : "false");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean getMustunderstandAttributeValue(String mu) {
|
||||
if (mu.equals("true") || mu.equals("1"))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected NameImpl getRelayAttributeName() {
|
||||
return NameImpl.create("relay", null, NameImpl.SOAP12_NAMESPACE);
|
||||
}
|
||||
|
||||
//relay attribute has literal value "true" or "false"
|
||||
@Override
|
||||
protected String getRelayLiteralValue(boolean relay) {
|
||||
return (relay == true ? "true" : "false");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean getRelayAttributeValue(String relay) {
|
||||
if (relay.equals("true") || relay.equals("1"))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getActorOrRole() {
|
||||
return getRole();
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -69,6 +69,7 @@ public class Message1_2Impl extends MessageImpl implements SOAPConstants{
|
||||
super(headers,ct,stat,reader);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SOAPPart getSOAPPart() {
|
||||
if (soapPartImpl == null)
|
||||
soapPartImpl = new SOAPPart1_2Impl(this);
|
||||
@ -76,14 +77,17 @@ public class Message1_2Impl extends MessageImpl implements SOAPConstants{
|
||||
return soapPartImpl;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isCorrectSoapVersion(int contentTypeId) {
|
||||
return (contentTypeId & SOAP1_2_FLAG) != 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getExpectedContentType() {
|
||||
return isFastInfoset ? "application/soap+fastinfoset" : "application/soap+xml";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getExpectedAcceptHeader() {
|
||||
String accept = "application/soap+xml, text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2";
|
||||
return acceptFastInfoset ? ("application/soap+fastinfoset, " + accept) : accept;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -39,14 +39,17 @@ import com.sun.xml.internal.messaging.saaj.soap.SOAPDocumentImpl;
|
||||
import com.sun.xml.internal.messaging.saaj.soap.SOAPFactoryImpl;
|
||||
|
||||
public class SOAPFactory1_2Impl extends SOAPFactoryImpl {
|
||||
@Override
|
||||
protected SOAPDocumentImpl createDocument() {
|
||||
return (new SOAPPart1_2Impl()).getDocument();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Detail createDetail() throws SOAPException {
|
||||
return new Detail1_2Impl(createDocument());
|
||||
}
|
||||
|
||||
@Override
|
||||
public SOAPFault createFault(String reasonText, QName faultCode)
|
||||
throws SOAPException {
|
||||
if (faultCode == null) {
|
||||
@ -55,14 +58,15 @@ public class SOAPFactory1_2Impl extends SOAPFactoryImpl {
|
||||
if (reasonText == null) {
|
||||
throw new IllegalArgumentException("reasonText argument for createFault was passed NULL");
|
||||
}
|
||||
Fault1_2Impl fault = new Fault1_2Impl(createDocument(), null);
|
||||
Fault1_2Impl fault = new Fault1_2Impl(createDocument());
|
||||
fault.setFaultCode(faultCode);
|
||||
fault.setFaultString(reasonText);
|
||||
return fault;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SOAPFault createFault() throws SOAPException {
|
||||
Fault1_2Impl fault = new Fault1_2Impl(createDocument(), null);
|
||||
Fault1_2Impl fault = new Fault1_2Impl(createDocument());
|
||||
fault.setFaultCode(fault.getDefaultFaultCode());
|
||||
fault.setFaultString("Fault string, and possibly fault code, not set");
|
||||
return fault;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -40,16 +40,19 @@ import com.sun.xml.internal.messaging.saaj.soap.MessageImpl;
|
||||
|
||||
public class SOAPMessageFactory1_2Impl extends MessageFactoryImpl {
|
||||
|
||||
@Override
|
||||
public SOAPMessage createMessage() throws SOAPException {
|
||||
return new Message1_2Impl();
|
||||
}
|
||||
|
||||
@Override
|
||||
public SOAPMessage createMessage(boolean isFastInfoset,
|
||||
boolean acceptFastInfoset) throws SOAPException
|
||||
{
|
||||
return new Message1_2Impl(isFastInfoset, acceptFastInfoset);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SOAPMessage createMessage(MimeHeaders headers, InputStream in) throws IOException, SOAPExceptionImpl {
|
||||
|
||||
if (headers == null) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -53,14 +53,17 @@ public class SOAPPart1_2Impl extends SOAPPartImpl implements SOAPConstants{
|
||||
super(message);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getContentType() {
|
||||
return "application/soap+xml";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Envelope createEmptyEnvelope(String prefix) throws SOAPException {
|
||||
return new Envelope1_2Impl(getDocument(), prefix, true, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Envelope createEnvelopeFromSource() throws SOAPException {
|
||||
XMLDeclarationParser parser = lookForXmlDecl();
|
||||
Source tmp = source;
|
||||
@ -82,6 +85,7 @@ public class SOAPPart1_2Impl extends SOAPPartImpl implements SOAPConstants{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SOAPPartImpl duplicateType() {
|
||||
return new SOAPPart1_2Impl();
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -53,6 +53,7 @@ public class ByteInputStream extends ByteArrayInputStream {
|
||||
return count;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
reset();
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -75,10 +75,12 @@ public class JAXMStreamSource extends StreamSource {
|
||||
this.reader = new CharArrayReader(cout.toCharArray(), 0, cout.size());
|
||||
}
|
||||
|
||||
@Override
|
||||
public InputStream getInputStream() {
|
||||
return in;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Reader getReader() {
|
||||
return reader;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -89,11 +89,13 @@ public class NamespaceContextIterator implements Iterator {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
findNext();
|
||||
return next != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object next() {
|
||||
return getNext();
|
||||
}
|
||||
@ -112,6 +114,7 @@ public class NamespaceContextIterator implements Iterator {
|
||||
return last;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
if (last == null) {
|
||||
throw new IllegalStateException();
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -96,6 +96,7 @@ public class RejectDoctypeSaxFilter extends XMLFilterImpl implements XMLReader,
|
||||
* Override setProperty() to capture any LexicalHandler that is set for
|
||||
* forwarding of events.
|
||||
*/
|
||||
@Override
|
||||
public void setProperty(String name, Object value)
|
||||
throws SAXNotRecognizedException, SAXNotSupportedException {
|
||||
if (LEXICAL_HANDLER_PROP.equals(name)) {
|
||||
@ -109,38 +110,45 @@ public class RejectDoctypeSaxFilter extends XMLFilterImpl implements XMLReader,
|
||||
// Beginning of SAX LexicalHandler callbacks...
|
||||
//
|
||||
|
||||
@Override
|
||||
public void startDTD(String name, String publicId, String systemId)
|
||||
throws SAXException {
|
||||
throw new SAXException("Document Type Declaration is not allowed");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void endDTD() throws SAXException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startEntity(String name) throws SAXException {
|
||||
if (lexicalHandler != null) {
|
||||
lexicalHandler.startEntity(name);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void endEntity(String name) throws SAXException {
|
||||
if (lexicalHandler != null) {
|
||||
lexicalHandler.endEntity(name);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startCDATA() throws SAXException {
|
||||
if (lexicalHandler != null) {
|
||||
lexicalHandler.startCDATA();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void endCDATA() throws SAXException {
|
||||
if (lexicalHandler != null) {
|
||||
lexicalHandler.endCDATA();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void comment(char[] ch, int start, int length) throws SAXException {
|
||||
if (lexicalHandler != null) {
|
||||
lexicalHandler.comment(ch, start, length);
|
||||
@ -151,6 +159,7 @@ public class RejectDoctypeSaxFilter extends XMLFilterImpl implements XMLReader,
|
||||
// End of SAX LexicalHandler callbacks
|
||||
//
|
||||
|
||||
@Override
|
||||
public void startElement(String namespaceURI, String localName,
|
||||
String qName, Attributes atts) throws SAXException{
|
||||
if(atts != null ){
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -46,44 +46,53 @@ public class TeeInputStream extends InputStream {
|
||||
this.source = source;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int read() throws IOException {
|
||||
int result = source.read();
|
||||
copySink.write(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int available() throws IOException {
|
||||
return source.available();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
source.close();
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void mark(int readlimit) {
|
||||
source.mark(readlimit);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean markSupported() {
|
||||
return source.markSupported();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int read(byte[] b, int off, int len) throws IOException {
|
||||
int result = source.read(b, off, len);
|
||||
copySink.write(b, off, len);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int read(byte[] b) throws IOException {
|
||||
int result = source.read(b);
|
||||
copySink.write(b);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void reset() throws IOException {
|
||||
source.reset();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long skip(long n) throws IOException {
|
||||
return source.skip(n);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -59,11 +59,13 @@ public class LazyEnvelopeStaxReader extends com.sun.xml.internal.org.jvnet.staxe
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getProperty(String name) throws IllegalArgumentException {
|
||||
if (usePayloadReaderDelegate) return payloadReader.getProperty(name);
|
||||
return super.getProperty(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int next() throws XMLStreamException {
|
||||
// boolean previouslyUsingPayloadReader = usePayloadReaderDelegate;
|
||||
//call checkReaderStatus to advance to payloadReader if needed
|
||||
@ -78,22 +80,26 @@ public class LazyEnvelopeStaxReader extends com.sun.xml.internal.org.jvnet.staxe
|
||||
return getEventType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void require(int type, String namespaceURI, String localName)
|
||||
throws XMLStreamException {
|
||||
if (usePayloadReaderDelegate) payloadReader.require(type, namespaceURI, localName);
|
||||
else super.require(type, namespaceURI, localName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getElementText() throws XMLStreamException {
|
||||
if (usePayloadReaderDelegate) return payloadReader.getElementText();
|
||||
return super.getElementText();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int nextTag() throws XMLStreamException {
|
||||
if (usePayloadReaderDelegate) return payloadReader.nextTag();
|
||||
return super.nextTag();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasNext() throws XMLStreamException {
|
||||
checkReaderStatus(false);
|
||||
boolean hasNext;
|
||||
@ -139,116 +145,139 @@ public class LazyEnvelopeStaxReader extends com.sun.xml.internal.org.jvnet.staxe
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() throws XMLStreamException {
|
||||
if (usePayloadReaderDelegate) payloadReader.close();
|
||||
else super.close();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNamespaceURI(String prefix) {
|
||||
if (usePayloadReaderDelegate) return payloadReader.getNamespaceURI(prefix);
|
||||
return super.getNamespaceURI(prefix);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isStartElement() {
|
||||
if (usePayloadReaderDelegate) return payloadReader.isStartElement();
|
||||
return super.isStartElement();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEndElement() {
|
||||
if (usePayloadReaderDelegate) return payloadReader.isEndElement();
|
||||
return super.isEndElement();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCharacters() {
|
||||
if (usePayloadReaderDelegate) return payloadReader.isCharacters();
|
||||
return super.isEndElement();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isWhiteSpace() {
|
||||
if (usePayloadReaderDelegate) return payloadReader.isWhiteSpace();
|
||||
return super.isWhiteSpace();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAttributeValue(String namespaceURI, String localName) {
|
||||
if (usePayloadReaderDelegate) return payloadReader.getAttributeValue(namespaceURI, localName);
|
||||
return super.getAttributeValue(namespaceURI, localName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAttributeCount() {
|
||||
if (usePayloadReaderDelegate) return payloadReader.getAttributeCount();
|
||||
return super.getAttributeCount();
|
||||
}
|
||||
|
||||
@Override
|
||||
public QName getAttributeName(int index) {
|
||||
if (usePayloadReaderDelegate) return payloadReader.getAttributeName(index);
|
||||
return super.getAttributeName(index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAttributeNamespace(int index) {
|
||||
if (usePayloadReaderDelegate) return payloadReader.getAttributeNamespace(index);
|
||||
return super.getAttributeNamespace(index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAttributeLocalName(int index) {
|
||||
if (usePayloadReaderDelegate) return payloadReader.getAttributeLocalName(index);
|
||||
return super.getAttributeLocalName(index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAttributePrefix(int index) {
|
||||
if (usePayloadReaderDelegate) return payloadReader.getAttributePrefix(index);
|
||||
return super.getAttributePrefix(index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAttributeType(int index) {
|
||||
if (usePayloadReaderDelegate) return payloadReader.getAttributeType(index);
|
||||
return super.getAttributeType(index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAttributeValue(int index) {
|
||||
if (usePayloadReaderDelegate) return payloadReader.getAttributeValue(index);
|
||||
return super.getAttributeValue(index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAttributeSpecified(int index) {
|
||||
if (usePayloadReaderDelegate) return payloadReader.isAttributeSpecified(index);
|
||||
return super.isAttributeSpecified(index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getNamespaceCount() {
|
||||
if (usePayloadReaderDelegate) return payloadReader.getNamespaceCount();
|
||||
return super.getNamespaceCount();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNamespacePrefix(int index) {
|
||||
if (usePayloadReaderDelegate) return payloadReader.getNamespacePrefix(index);
|
||||
return super.getNamespacePrefix(index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNamespaceURI(int index) {
|
||||
if (usePayloadReaderDelegate) return payloadReader.getNamespaceURI(index);
|
||||
return super.getNamespaceURI(index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NamespaceContext getNamespaceContext() {
|
||||
if (usePayloadReaderDelegate) return payloadReader.getNamespaceContext();
|
||||
return super.getNamespaceContext();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEventType() {
|
||||
if (usePayloadReaderDelegate) return payloadReader.getEventType();
|
||||
return super.getEventType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getText() {
|
||||
if (usePayloadReaderDelegate) return payloadReader.getText();
|
||||
return super.getText();
|
||||
}
|
||||
|
||||
@Override
|
||||
public char[] getTextCharacters() {
|
||||
if (usePayloadReaderDelegate) return payloadReader.getTextCharacters();
|
||||
return super.getTextCharacters();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTextCharacters(int sourceStart, char[] target,
|
||||
int targetStart, int length) throws XMLStreamException {
|
||||
if (usePayloadReaderDelegate) return payloadReader.getTextCharacters(sourceStart, target, targetStart,
|
||||
@ -256,81 +285,97 @@ public class LazyEnvelopeStaxReader extends com.sun.xml.internal.org.jvnet.staxe
|
||||
return super.getTextCharacters(sourceStart, target, targetStart, length);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTextStart() {
|
||||
if (usePayloadReaderDelegate) return payloadReader.getTextStart();
|
||||
return super.getTextStart();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTextLength() {
|
||||
if (usePayloadReaderDelegate) return payloadReader.getTextLength();
|
||||
return super.getTextLength();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEncoding() {
|
||||
if (usePayloadReaderDelegate) return payloadReader.getEncoding();
|
||||
return super.getEncoding();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasText() {
|
||||
if (usePayloadReaderDelegate) return payloadReader.hasText();
|
||||
return super.hasText();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Location getLocation() {
|
||||
if (usePayloadReaderDelegate) return payloadReader.getLocation();
|
||||
return super.getLocation();
|
||||
}
|
||||
|
||||
@Override
|
||||
public QName getName() {
|
||||
if (usePayloadReaderDelegate) return payloadReader.getName();
|
||||
return super.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLocalName() {
|
||||
if (usePayloadReaderDelegate) return payloadReader.getLocalName();
|
||||
return super.getLocalName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasName() {
|
||||
if (usePayloadReaderDelegate) return payloadReader.hasName();
|
||||
return super.hasName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNamespaceURI() {
|
||||
if (usePayloadReaderDelegate) return payloadReader.getNamespaceURI();
|
||||
return super.getNamespaceURI();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPrefix() {
|
||||
if (usePayloadReaderDelegate) return payloadReader.getPrefix();
|
||||
return super.getPrefix();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getVersion() {
|
||||
if (usePayloadReaderDelegate) return payloadReader.getVersion();
|
||||
return super.getVersion();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isStandalone() {
|
||||
if (usePayloadReaderDelegate) return payloadReader.isStandalone();
|
||||
return super.isStandalone();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean standaloneSet() {
|
||||
if (usePayloadReaderDelegate) return payloadReader.standaloneSet();
|
||||
return super.standaloneSet();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCharacterEncodingScheme() {
|
||||
if (usePayloadReaderDelegate) return payloadReader.getCharacterEncodingScheme();
|
||||
return super.getCharacterEncodingScheme();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPITarget() {
|
||||
if (usePayloadReaderDelegate) return payloadReader.getPITarget();
|
||||
return super.getPITarget();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPIData() {
|
||||
if (usePayloadReaderDelegate) return payloadReader.getPIData();
|
||||
return super.getPIData();
|
||||
|
@ -335,24 +335,30 @@ public class SaajStaxWriter implements XMLStreamWriter {
|
||||
@Override
|
||||
public NamespaceContext getNamespaceContext() {
|
||||
return new NamespaceContext() {
|
||||
@Override
|
||||
public String getNamespaceURI(final String prefix) {
|
||||
return currentElement.getNamespaceURI(prefix);
|
||||
}
|
||||
@Override
|
||||
public String getPrefix(final String namespaceURI) {
|
||||
return currentElement.lookupPrefix(namespaceURI);
|
||||
}
|
||||
@Override
|
||||
public Iterator getPrefixes(final String namespaceURI) {
|
||||
return new Iterator<String>() {
|
||||
String prefix = getPrefix(namespaceURI);
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
return (prefix != null);
|
||||
}
|
||||
@Override
|
||||
public String next() {
|
||||
if (!hasNext()) throw new java.util.NoSuchElementException();
|
||||
String next = prefix;
|
||||
prefix = null;
|
||||
return next;
|
||||
}
|
||||
@Override
|
||||
public void remove() {}
|
||||
};
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -67,6 +67,7 @@ public class SaajStaxWriterEx extends SaajStaxWriter implements XMLStreamWriterE
|
||||
super(msg, uri);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeStartElement(String prefix, String ln, String ns) throws XMLStreamException {
|
||||
if (xopNS.equals(ns) && Include.equals(ln)) {
|
||||
state = State.xopInclude;
|
||||
@ -108,31 +109,41 @@ public class SaajStaxWriterEx extends SaajStaxWriter implements XMLStreamWriterE
|
||||
@Override
|
||||
public NamespaceContextEx getNamespaceContext() {
|
||||
return new NamespaceContextEx() {
|
||||
@Override
|
||||
public String getNamespaceURI(String prefix) {
|
||||
return currentElement.getNamespaceURI(prefix);
|
||||
}
|
||||
@Override
|
||||
public String getPrefix(String namespaceURI) {
|
||||
return currentElement.lookupPrefix(namespaceURI);
|
||||
}
|
||||
@Override
|
||||
public Iterator getPrefixes(final String namespaceURI) {
|
||||
return new Iterator<String>() {
|
||||
String prefix = getPrefix(namespaceURI);
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
return (prefix != null);
|
||||
}
|
||||
@Override
|
||||
public String next() {
|
||||
if (prefix == null) throw new java.util.NoSuchElementException();
|
||||
String next = prefix;
|
||||
prefix = null;
|
||||
return next;
|
||||
}
|
||||
@Override
|
||||
public void remove() {}
|
||||
};
|
||||
}
|
||||
@Override
|
||||
public Iterator<Binding> iterator() {
|
||||
return new Iterator<Binding>() {
|
||||
@Override
|
||||
public boolean hasNext() { return false; }
|
||||
@Override
|
||||
public Binding next() { return null; }
|
||||
@Override
|
||||
public void remove() {}
|
||||
};
|
||||
}
|
||||
@ -208,6 +219,7 @@ public class SaajStaxWriterEx extends SaajStaxWriter implements XMLStreamWriterE
|
||||
return hrefOrCid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AttachmentMarshaller getAttachmentMarshaller() {
|
||||
return new AttachmentMarshaller() {
|
||||
@Override
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user