Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
EclipseLink/DesignDocs/293925/Phase9
Phase 9 - Attachments
Provide support for WebService attachments. Note that information pertaining to XmlAttachmentRef and XmlMimeType support can be found here.
Annotations
The following annotations will be targetted in this phase:
Annotation | XML Metadata Tag | Package | Type | Field | Method |
---|---|---|---|---|---|
XmlInlineBinaryData | xml-inline-binary-data | X | X | X |
Example: Class-level XmlInlineBinaryData Annotation
Java Metadata
The following example will demonstrate how the XmlInlineBinaryData annotation can be applied at the class level:
org.example.MyData.java
package org.example; @javax.xml.bind.annotation.XmlInlineBinaryData @javax.xml.bind.annotation.XmlRootElement(name="my-data") public class MyData { private DataHandler myDataHandler; public byte[] bytes; public DataHandler getData() { return myDataHandler; } public void setData(DataHandler data) { myDataHandler = data; } }
XML Metadata
xml-inline-binary-data
If this is present in XML, the corresponding annotation will be ignored, and the true/false value set in XML used instead. Note that an @XmlInlineBinaryData annotated property will not be overridden by a class-level xml-inline-binary-data declaration in XML.
org/example/eclipselink-oxm.xml
This XML file represents metadata overrides for the "org.example" package.
<?xml version="1.0" encoding="US-ASCII"?> <xml-bindings xmlns="http://www.eclipse.org/eclipselink/xsds/persistence/oxm"> <java-types> <java-type name="org.example.MyData" xml-inline-binary-data="true"> <xml-root-element name="my-data"/> </java-type> </java-types> </xml-bindings>
Example: Property-level XmlInlineBinaryData Annotation
Java Metadata
The following example will demonstrate how the XmlInlineBinaryData annotation can be applied at the property level:
org.example.MyData.java
package org.example; @javax.xml.bind.annotation.XmlRootElement(name="my-data") public class MyData { private DataHandler myDataHandler; @javax.xml.bind.annotation.XmlInlineBinaryData public byte[] bytes; @javax.xml.bind.annotation.XmlInlineBinaryData public DataHandler getData() { return myDataHandler; } public void setData(DataHandler data) { myDataHandler = data; } }
XML Metadata
xml-inline-binary-data
If this is present in XML, the corresponding annotation will be ignored, and the true/false value set in XML used instead.
org/example/eclipselink-oxm.xml
This XML file represents metadata overrides for the "org.example" package.
<?xml version="1.0" encoding="US-ASCII"?> <xml-bindings xmlns="http://www.eclipse.org/eclipselink/xsds/persistence/oxm"> <java-types> <java-type name="org.example.MyData"> <xml-root-element name="my-data"/> <java-attributes> <xml-element java-attribute="bytes" xml-inline-binary-data="true" /> <xml-element java-attribute="data" xml-inline-binary-data="true" /> </java-attributes> </java-type> </java-types> </xml-bindings>