src/share/jaxws_classes/com/sun/xml/internal/ws/message/EmptyMessageImpl.java

changeset 368
0989ad8c0860
parent 286
f50545b5e2f1
child 637
9c07ef4934dd
equal deleted inserted replaced
366:8c0b6bccfe47 368:0989ad8c0860
1 /* 1 /*
2 * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 1997, 2013, 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
26 package com.sun.xml.internal.ws.message; 26 package com.sun.xml.internal.ws.message;
27 27
28 import com.sun.istack.internal.NotNull; 28 import com.sun.istack.internal.NotNull;
29 import com.sun.xml.internal.ws.api.SOAPVersion; 29 import com.sun.xml.internal.ws.api.SOAPVersion;
30 import com.sun.xml.internal.ws.api.message.AttachmentSet; 30 import com.sun.xml.internal.ws.api.message.AttachmentSet;
31 import com.sun.xml.internal.ws.api.message.Header;
32 import com.sun.xml.internal.ws.api.message.HeaderList; 31 import com.sun.xml.internal.ws.api.message.HeaderList;
33 import com.sun.xml.internal.ws.api.message.Message; 32 import com.sun.xml.internal.ws.api.message.Message;
33 import com.sun.xml.internal.ws.api.message.MessageHeaders;
34
34 import org.xml.sax.ContentHandler; 35 import org.xml.sax.ContentHandler;
35 import org.xml.sax.ErrorHandler; 36 import org.xml.sax.ErrorHandler;
36 import org.xml.sax.SAXException; 37 import org.xml.sax.SAXException;
37 38
38 import javax.xml.soap.SOAPException;
39 import javax.xml.soap.SOAPMessage;
40 import javax.xml.stream.XMLStreamException; 39 import javax.xml.stream.XMLStreamException;
41 import javax.xml.stream.XMLStreamReader; 40 import javax.xml.stream.XMLStreamReader;
42 import javax.xml.stream.XMLStreamWriter; 41 import javax.xml.stream.XMLStreamWriter;
43 import javax.xml.transform.Source; 42 import javax.xml.transform.Source;
44 43
51 50
52 /** 51 /**
53 * If a message has no payload, it's more likely to have 52 * If a message has no payload, it's more likely to have
54 * some header, so we create it eagerly here. 53 * some header, so we create it eagerly here.
55 */ 54 */
56 private final HeaderList headers; 55 private final MessageHeaders headers;
57 private final AttachmentSet attachmentSet; 56 private final AttachmentSet attachmentSet;
58 57
59 public EmptyMessageImpl(SOAPVersion version) { 58 public EmptyMessageImpl(SOAPVersion version) {
60 super(version); 59 super(version);
61 this.headers = new HeaderList(); 60 this.headers = new HeaderList(version);
62 this.attachmentSet = new AttachmentSetImpl(); 61 this.attachmentSet = new AttachmentSetImpl();
63 } 62 }
64 63
65 public EmptyMessageImpl(HeaderList headers, @NotNull AttachmentSet attachmentSet, SOAPVersion version){ 64 public EmptyMessageImpl(MessageHeaders headers, @NotNull AttachmentSet attachmentSet, SOAPVersion version){
66 super(version); 65 super(version);
67 if(headers==null) 66 if(headers==null)
68 headers = new HeaderList(); 67 headers = new HeaderList(version);
69 this.attachmentSet = attachmentSet; 68 this.attachmentSet = attachmentSet;
70 this.headers = headers; 69 this.headers = headers;
71 } 70 }
72 71
73 /** 72 /**
78 this.headers = new HeaderList(that.headers); 77 this.headers = new HeaderList(that.headers);
79 this.attachmentSet = that.attachmentSet; 78 this.attachmentSet = that.attachmentSet;
80 } 79 }
81 80
82 public boolean hasHeaders() { 81 public boolean hasHeaders() {
83 return !headers.isEmpty(); 82 return headers.hasHeaders();
84 } 83 }
85 84
86 public HeaderList getHeaders() { 85 public MessageHeaders getHeaders() {
87 return headers; 86 return headers;
88 } 87 }
89 88
90 public String getPayloadLocalPart() { 89 public String getPayloadLocalPart() {
91 return null; 90 return null;
116 } 115 }
117 116
118 public Message copy() { 117 public Message copy() {
119 return new EmptyMessageImpl(this); 118 return new EmptyMessageImpl(this);
120 } 119 }
120
121 } 121 }

mercurial