author | mkos |
Mon, 31 Mar 2014 10:43:20 +0200 | |
changeset 23782 | 953bfc3fbe31 |
parent 16791 | fe5141eabb0e |
permissions | -rw-r--r-- |
12009 | 1 |
/* |
23782
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
16791
diff
changeset
|
2 |
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. |
12009 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
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 |
|
7 |
* published by the Free Software Foundation. Oracle designates this |
|
8 |
* particular file as subject to the "Classpath" exception as provided |
|
9 |
* by Oracle in the LICENSE file that accompanied this code. |
|
10 |
* |
|
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
15 |
* accompanied this code). |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License version |
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 |
* |
|
21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
22 |
* or visit www.oracle.com if you need additional information or have any |
|
23 |
* questions. |
|
24 |
*/ |
|
25 |
||
26 |
package com.sun.xml.internal.ws.message; |
|
27 |
||
28 |
import com.sun.istack.internal.NotNull; |
|
29 |
import com.sun.xml.internal.ws.api.SOAPVersion; |
|
30 |
import com.sun.xml.internal.ws.api.message.AttachmentSet; |
|
31 |
import com.sun.xml.internal.ws.api.message.HeaderList; |
|
32 |
import com.sun.xml.internal.ws.api.message.Message; |
|
16791 | 33 |
import com.sun.xml.internal.ws.api.message.MessageHeaders; |
34 |
||
12009 | 35 |
import org.xml.sax.ContentHandler; |
36 |
import org.xml.sax.ErrorHandler; |
|
37 |
import org.xml.sax.SAXException; |
|
38 |
||
39 |
import javax.xml.stream.XMLStreamException; |
|
40 |
import javax.xml.stream.XMLStreamReader; |
|
41 |
import javax.xml.stream.XMLStreamWriter; |
|
42 |
import javax.xml.transform.Source; |
|
43 |
||
44 |
/** |
|
45 |
* {@link Message} that has no body. |
|
46 |
* |
|
47 |
* @author Kohsuke Kawaguchi |
|
48 |
*/ |
|
49 |
public class EmptyMessageImpl extends AbstractMessageImpl { |
|
50 |
||
51 |
/** |
|
52 |
* If a message has no payload, it's more likely to have |
|
53 |
* some header, so we create it eagerly here. |
|
54 |
*/ |
|
16791 | 55 |
private final MessageHeaders headers; |
12009 | 56 |
private final AttachmentSet attachmentSet; |
57 |
||
58 |
public EmptyMessageImpl(SOAPVersion version) { |
|
59 |
super(version); |
|
16791 | 60 |
this.headers = new HeaderList(version); |
12009 | 61 |
this.attachmentSet = new AttachmentSetImpl(); |
62 |
} |
|
63 |
||
16791 | 64 |
public EmptyMessageImpl(MessageHeaders headers, @NotNull AttachmentSet attachmentSet, SOAPVersion version){ |
12009 | 65 |
super(version); |
66 |
if(headers==null) |
|
16791 | 67 |
headers = new HeaderList(version); |
12009 | 68 |
this.attachmentSet = attachmentSet; |
69 |
this.headers = headers; |
|
70 |
} |
|
71 |
||
72 |
/** |
|
73 |
* Copy constructor. |
|
74 |
*/ |
|
75 |
private EmptyMessageImpl(EmptyMessageImpl that) { |
|
76 |
super(that); |
|
77 |
this.headers = new HeaderList(that.headers); |
|
78 |
this.attachmentSet = that.attachmentSet; |
|
23782
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
16791
diff
changeset
|
79 |
this.copyFrom(that); |
12009 | 80 |
} |
81 |
||
82 |
public boolean hasHeaders() { |
|
16791 | 83 |
return headers.hasHeaders(); |
12009 | 84 |
} |
85 |
||
16791 | 86 |
public MessageHeaders getHeaders() { |
12009 | 87 |
return headers; |
88 |
} |
|
89 |
||
90 |
public String getPayloadLocalPart() { |
|
91 |
return null; |
|
92 |
} |
|
93 |
||
94 |
public String getPayloadNamespaceURI() { |
|
95 |
return null; |
|
96 |
} |
|
97 |
||
98 |
public boolean hasPayload() { |
|
99 |
return false; |
|
100 |
} |
|
101 |
||
102 |
public Source readPayloadAsSource() { |
|
103 |
return null; |
|
104 |
} |
|
105 |
||
106 |
public XMLStreamReader readPayload() throws XMLStreamException { |
|
107 |
return null; |
|
108 |
} |
|
109 |
||
110 |
public void writePayloadTo(XMLStreamWriter sw) throws XMLStreamException { |
|
111 |
// noop |
|
112 |
} |
|
113 |
||
114 |
public void writePayloadTo(ContentHandler contentHandler, ErrorHandler errorHandler, boolean fragment) throws SAXException { |
|
115 |
// noop |
|
116 |
} |
|
117 |
||
118 |
public Message copy() { |
|
23782
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
16791
diff
changeset
|
119 |
return new EmptyMessageImpl(this).copyFrom(this); |
12009 | 120 |
} |
16791 | 121 |
|
12009 | 122 |
} |