/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

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