All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jboss.resteasy.annotations.providers.multipart.XopWithMultipartRelated Maven / Gradle / Ivy

There is a newer version: 7.0.0.Alpha4
Show newest version
package org.jboss.resteasy.annotations.providers.multipart;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

import jakarta.xml.bind.annotation.XmlMimeType;

/**
 * This annotation can be used to process/produce incoming/outgoing XOP messages
 * (packaged as multipart/related) to/from JAXB annotated objects.
 *
 * 

* XOP packaging can be suitable if you have to work with binary content and you * don't want to encode it (for example in base64 or hex inside an xml). XOP * makes it possible to pass binary through the network without any encoding on * it (binary contents will travel in separate parts of the multipart/related * message). *

* *

* Example. A bean annotated with JAXB. {@link XmlMimeType} tells JAXB the mime * type of the binary content (its not required to do XOP packaging but it is * recommended to be set if you know the exact type): * *

 * @XmlRootElement
 * @XmlAccessorType(XmlAccessType.FIELD)
 * public static class Xop {
 *     private Customer bill;
 *
 *     private Customer monica;
 *
 *     @XmlMimeType(MediaType.APPLICATION_OCTET_STREAM)
 *     private byte[] myBinary;
 *
 *     @XmlMimeType(MediaType.APPLICATION_OCTET_STREAM)
 *     private DataHandler myDataHandler;
 *
 *     // methods, other fields ...
 * }
 * 
* * A REST Service method parameters/return value annotated with * {@link XopWithMultipartRelated} and consuming/producing * {@link org.jboss.resteasy.plugins.providers.multipart.MultipartConstants#MULTIPART_RELATED}: * *
 * @PUT
 * @Path("xop")
 * @Consumes(org.jboss.resteasy.plugins.providers.multipart.MultipartConstants.MULTIPART_RELATED)
 * public void putXopWithMultipartRelated(@XopWithMultipartRelated Xop xop) {
 * }
 * 
* *

* More about XOP can be read here: http://www.w3.org/TR/xop10 *

* * @author Attila Kiraly * @version $Revision: 1 $ */ @Target({ ElementType.PARAMETER, ElementType.METHOD, ElementType.FIELD }) @Retention(RetentionPolicy.RUNTIME) public @interface XopWithMultipartRelated { }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy