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     * HttpMethod.java
015     *
016     * Created on October 25, 2006, 2:02 PM
017     *
018     */
019    
020    package javax.ws.rs;
021    
022    import java.lang.annotation.Documented;
023    import java.lang.annotation.ElementType;
024    import java.lang.annotation.Retention;
025    import java.lang.annotation.RetentionPolicy;
026    import java.lang.annotation.Target;
027    
028    /**
029     * Associates the name of a HTTP method with an annotation. A Java method annotated
030     * with a runtime annotation that is itself annotated with this annotation will
031     * be used to handle HTTP requests of the indicated HTTP method. It is an error
032     * for a method to be annotated with more than one annotation that is annotated
033     * with {@code HttpMethod}.
034     *
035     * @see GET
036     * @see POST
037     * @see PUT
038     * @see DELETE
039     * @see HEAD
040     */
041    @Target({ElementType.ANNOTATION_TYPE})
042    @Retention(RetentionPolicy.RUNTIME)
043    @Documented
044    public @interface HttpMethod {
045        
046        /**
047         * HTTP GET method
048         */
049        public static final String GET="GET";
050        /**
051         * HTTP POST method
052         */
053        public static final String POST="POST"; 
054        /**
055         * HTTP PUT method
056         */
057        public static final String PUT="PUT";
058        /**
059         * HTTP DELETE method
060         */
061        public static final String DELETE="DELETE";
062        /**
063         * HTTP HEAD method
064         */
065        public static final String HEAD="HEAD";
066        /**
067         * HTTP OPTIONS method
068         */
069        public static final String OPTIONS="OPTIONS";
070        
071        /**
072         * Specifies the name of a HTTP method. E.g. "GET".
073         */
074        String value();        
075    }