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 * Consumes.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 types that the methods of a resource class or
030 * {@link javax.ws.rs.ext.MessageBodyReader} can accept. If
031 * not specified, a container will assume that any media type is acceptable.
032 * Method level annotations override a class level annotation. A container
033 * is responsible for ensuring that the method invoked is capable of consuming
034 * the media type of the HTTP request entity body. If no such method is
035 * available the container must respond with a HTTP "415 Unsupported Media Type"
036 * as specified by RFC 2616.
037 *
038 * @see javax.ws.rs.ext.MessageBodyReader
039 */
040 @Inherited
041 @Target({ElementType.TYPE, ElementType.METHOD})
042 @Retention(RetentionPolicy.RUNTIME)
043 public @interface Consumes {
044 /**
045 * A list of media types. Each entry may specify a single type or consist
046 * of a comma separated list of types. E.g. {"image/jpeg,image/gif",
047 * "image/png"}. Use of the comma-separated form allows definition of a
048 * common string constant for use on multiple targets.
049 */
050 String[] value() default "*/*";
051 }