/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* 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.
*/
/**
* {@link Message} backed by a JAXB bean.
*
* @author Kohsuke Kawaguchi
*/
/**
* The JAXB object that represents the payload.
*/
/**
* Lazily sniffed payload element name
*/
/**
* If we have the infoset representation for the payload, this field is non-null.
*/
public static Message create(JAXBRIContext context, Object jaxbObject, SOAPVersion soapVersion, HeaderList headers, AttachmentSet attachments) {
}
// If we have swaRef, then that means we might have attachments.
// to comply with the packet API, we need to eagerly turn the JAXB object into infoset
// to correctly find out about attachments.
try {
// any way to reuse this XMLStreamBuffer in StreamMessage?
} catch (JAXBException e) {
throw new WebServiceException(e);
} catch (XMLStreamException e) {
throw new WebServiceException(e);
}
}
/**
* Creates a {@link Message} backed by a JAXB bean.
*
* @param context
* The JAXBContext to be used for marshalling.
* @param jaxbObject
* The JAXB object that represents the payload. must not be null. This object
* must be bound to an element (which means it either is a {@link JAXBElement} or
* an instanceof a class with {@link XmlRootElement}).
* @param soapVersion
* The SOAP version of the message. Must not be null.
*/
}
private JAXBMessage( JAXBRIContext context, Object jaxbObject, SOAPVersion soapVer, HeaderList headers, AttachmentSet attachments ) {
super(soapVer);
this.jaxbObject = jaxbObject;
this.attachmentSet = attachments;
}
/**
* Creates a {@link Message} backed by a JAXB bean.
*
* @param bridge
* Specify the payload tag name and how <tt>jaxbObject</tt> is bound.
* @param jaxbObject
*/
}
// If we have swaRef, then that means we might have attachments.
// to comply with the packet API, we need to eagerly turn the JAXB object into infoset
// to correctly find out about attachments.
try {
// any way to reuse this XMLStreamBuffer in StreamMessage?
} catch (JAXBException e) {
throw new WebServiceException(e);
} catch (XMLStreamException e) {
throw new WebServiceException(e);
}
}
super(soapVer);
// TODO: think about a better way to handle BridgeContext
this.jaxbObject = jaxbObject;
this.attachmentSet = new AttachmentSetImpl();
}
/**
* Copy constructor.
*/
super(that);
}
public boolean hasHeaders() {
}
headers = new HeaderList();
return headers;
}
sniff();
return localName;
}
sniff();
return nsUri;
}
public boolean hasPayload() {
return true;
}
/**
* Obtains the tag name of the root element.
*/
private void sniff() {
try {
} catch (JAXBException e) {
// if it's due to us aborting the processing after the first element,
// we can safely ignore this exception.
//
// if it's due to error in the object, the same error will be reported
// when the readHeader() method is used, so we don't have to report
// an error right now.
}
}
}
try {
} catch (SAXException e) {
throw new JAXBException(e);
}
}
try {
}
return reader;
} catch (JAXBException e) {
// bug 6449684, spec 4.3.4
throw new WebServiceException(e);
}
}
/**
* Writes the payload as SAX events.
*/
protected void writePayloadTo(ContentHandler contentHandler, ErrorHandler errorHandler, boolean fragment) throws SAXException {
try {
if(fragment)
} catch (JAXBException e) {
// this is really more helpful but spec compliance
// errorHandler.fatalError(new SAXParseException(e.getMessage(),NULL_LOCATOR,e));
// bug 6449684, spec 4.3.4
throw new WebServiceException(e.getMessage(),e);
}
}
try {
// MtomCodec sets its own AttachmentMarshaller
// Get output stream and use JAXB UTF-8 writer
} else {
}
//cleanup() is not needed since JAXB doesn't keep ref to AttachmentMarshaller
//am.cleanup();
} catch (JAXBException e) {
// bug 6449684, spec 4.3.4
throw new WebServiceException(e);
}
}
return new JAXBMessage(this);
}
}