Import javax.ws.rs.Produces;
* * * Produces.java * Created on September, 2006, 2:40 PM * * Package javax.ws.rs;
Import Java.lang.annotation.ElementType;
Import java.lang.annotation.Inherited;
Import java.lang.annotation.Retention;
Import Java.lang.annotation.RetentionPolicy;
Import Java.lang.annotation.Target; /** * Defines the media type (s) that the methods of a resource class or * {@link javax.ws.rs.ext.MessageBodyWriter} can
Produce.
* If not specified then a container would assume that any type can be produced. * Method level annotations Override a class level annotation. A Container * is responsible for ensuring this method invoked is capable of producing * one of the media types Reque Sted in the HTTP request.
If no such method are * available The container must respond with a HTTP ' 406 not acceptable ' as * specified by RFC 2616. * <p>a method for which there is A single-valued <code>Produces</code> * are not required to set th E Media type of representations that it prodUCEs: * The container would use the value of the <code>Produces</code> when * sending a response.</p> * * @see Javax.ws.rs.ext.MessageBodyWriter//defines the resource type or the Messagebodywriter media type generation method; If there is no special statement, then a container will assume that any type can be produced; The annotation level of the method overrides the class annotation level, and a container is responsible for guaranteeing the referenced method, which enables the production of a request media type in an HTTP request. In the absence of such a method, the container responds to HTTP with a "406 not acceptable" message;//A single valued produces method is not required to set the type of media that represents his production: when sending a response request, The container will use the produces value. For details, see the Javax.ws.rs.ext.MessageBodyWriter @Inherited @Target ({elementtype.type, elementtype.method}) @Retention ( Retentionpolicy.runtime) Public @interface produces {/** * A list of media types. Each entry could specify a single type or consist * of a comma separated list of types. e.g. {"Image/jpeg,image/gif", * "Image/png"}.
Use of the comma-separated form allows the definition of a * common string constant to use on multiple targets. * A range of media types. Each entry may specifically prescribe a single type or separate a series of types with commas, such as {"Image/jpeg,image/gif", * "Image/png"} * allow a comma-delimited form to define an ordinary string-type constant.To use the multimedia target */string[] value () default "*/*";
}