PageRenderTime 35ms CodeModel.GetById 32ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/sitebricks/src/main/java/com/google/sitebricks/http/Select.java

http://github.com/dhanji/sitebricks
Java | 34 lines | 7 code | 2 blank | 25 comment | 0 complexity | 48ed8315fd52952ceca2b53b15ecfd52 MD5 | raw file
 1package com.google.sitebricks.http;
 2
 3import java.lang.annotation.Retention;
 4import java.lang.annotation.RetentionPolicy;
 5
 6/**
 7 * This annotation is used to select request handlers based on
 8 * request parameters. For example, in a single resource URL, you
 9 * may wish to call different handlers for POST based on the request
10 * parameter "action" (action=update, action=delete, etc.). These
11 * maybe modeled as form parameters or as part of the query string.
12 *
13 * <pre>
14 *   {@literal @}At("/city/atlantis") {@literal @} Select("action")
15 *   public class PictureWebService {
16 *
17 *     {@literal @}Post("update")
18 *     public void update() {
19 *       // edit resource in place
20 *     }
21 *
22 *     {@literal @}Post("delete")
23 *     public void delete() {
24 *       // remove the item...
25 *     }
26 *   }
27 * </pre>
28 *
29 * @author Dhanji R. Prasanna (dhanji@gmail.com)
30 */
31@Retention(RetentionPolicy.RUNTIME)
32public @interface Select {
33  String value();
34}