1 /* |
1 /* |
2 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
24 */ |
24 */ |
25 |
25 |
26 package com.sun.xml.internal.ws.streaming; |
26 package com.sun.xml.internal.ws.streaming; |
27 |
27 |
28 import com.sun.istack.internal.Nullable; |
28 import com.sun.istack.internal.Nullable; |
|
29 import com.sun.xml.internal.ws.api.streaming.XMLStreamWriterFactory; |
29 import com.sun.xml.internal.ws.encoding.HasEncoding; |
30 import com.sun.xml.internal.ws.encoding.HasEncoding; |
30 import com.sun.xml.internal.ws.encoding.SOAPBindingCodec; |
31 import com.sun.xml.internal.ws.encoding.SOAPBindingCodec; |
31 |
32 |
32 import javax.xml.namespace.QName; |
33 import javax.xml.namespace.QName; |
33 import javax.xml.stream.XMLStreamWriter; |
34 import javax.xml.stream.XMLStreamWriter; |
55 * @throws XMLStreamException if any of writer operations throw the exception |
56 * @throws XMLStreamException if any of writer operations throw the exception |
56 */ |
57 */ |
57 public static @Nullable OutputStream getOutputStream(XMLStreamWriter writer) throws XMLStreamException { |
58 public static @Nullable OutputStream getOutputStream(XMLStreamWriter writer) throws XMLStreamException { |
58 Object obj = null; |
59 Object obj = null; |
59 |
60 |
|
61 XMLStreamWriter xmlStreamWriter = |
|
62 writer instanceof XMLStreamWriterFactory.HasEncodingWriter ? |
|
63 ((XMLStreamWriterFactory.HasEncodingWriter) writer).getWriter() |
|
64 : writer; |
|
65 |
|
66 |
60 // Hack for JDK6's SJSXP |
67 // Hack for JDK6's SJSXP |
61 if (writer instanceof Map) { |
68 if (xmlStreamWriter instanceof Map) { |
62 obj = ((Map) writer).get("sjsxp-outputstream"); |
69 obj = ((Map) xmlStreamWriter).get("sjsxp-outputstream"); |
63 } |
70 } |
64 |
71 |
65 // woodstox |
72 // woodstox |
66 if (obj == null) { |
73 if (obj == null) { |
67 try { |
74 try { |