001    /*
002     * The contents of this file are subject to the terms
003     * of the Common Development and Distribution License
004     * (the "License").  You may not use this file except
005     * in compliance with the License.
006     * 
007     * You can obtain a copy of the license at
008     * http://www.opensource.org/licenses/cddl1.php
009     * See the License for the specific language governing
010     * permissions and limitations under the License.
011     */
012    
013    /*
014     * Produces.java
015     *
016     * Created on September 15, 2006, 2:40 PM
017     *
018     */
019    
020    package javax.ws.rs;
021    
022    import java.lang.annotation.ElementType;
023    import java.lang.annotation.Inherited;
024    import java.lang.annotation.Retention;
025    import java.lang.annotation.RetentionPolicy;
026    import java.lang.annotation.Target;
027    
028    /**
029     * Defines the media type(s) that the methods of a resource class or
030     * {@link javax.ws.rs.ext.MessageBodyWriter} can produce.
031     * If not specified then a container will assume that any type can be produced.
032     * Method level annotations override a class level annotation. A container
033     * is responsible for ensuring that the method invoked is capable of producing
034     * one of the media types requested in the HTTP request. If no such method is
035     * available the container must respond with a HTTP "406 Not Acceptable" as
036     * specified by RFC 2616.
037     *
038     * <p>A method for which there is a single-valued <code>Produces</code>
039     * is not required to set the media type of representations that it produces:
040     * the container will use the value of the <code>Produces</code> when
041     * sending a response.</p>
042     *
043     * @see javax.ws.rs.ext.MessageBodyWriter
044     */
045    @Inherited
046    @Target({ElementType.TYPE, ElementType.METHOD})
047    @Retention(RetentionPolicy.RUNTIME)
048    public @interface Produces {
049        /**
050         * A list of media types. Each entry may specify a single type or consist
051         * of a comma separated list of types. E.g. {"image/jpeg,image/gif",
052         * "image/png"}. Use of the comma-separated form allows definition of a
053         * common string constant for use on multiple targets.
054         */
055        String[] value() default "*/*";    
056    }