Newer
Older
gitbucket_jkp / src / main / scala / util / Keys.scala
@takezoe takezoe on 22 Sep 2013 1 KB Define request attribute keys.
  1. package util
  2.  
  3. /**
  4. * Define key strings for request attributes, session attributes or flash attributes.
  5. */
  6. object Keys {
  7.  
  8. /**
  9. * Define session keys.
  10. */
  11. object Session {
  12.  
  13. /**
  14. * Session key for the logged in account information.
  15. */
  16. val LoginAccount = "LOGIN_ACCOUNT"
  17.  
  18. /**
  19. * Session key for the redirect URL.
  20. */
  21. val Redirect = "REDIRECT"
  22.  
  23. /**
  24. * Session key for the issue search condition in dashboard.
  25. */
  26. val DashboardIssues = "dashboard/issues"
  27.  
  28. /**
  29. * Session key for the pull request search condition in dashboard.
  30. */
  31. val DashboardPulls = "dashboard/pulls"
  32.  
  33. /**
  34. * Generate session key for the issue search condition.
  35. */
  36. def Issues(owner: String, name: String) = s"${owner}/${name}/issues"
  37.  
  38. /**
  39. * Generate session key for the pull request search condition.
  40. */
  41. def Pulls(owner: String, name: String) = s"${owner}/${name}/pulls"
  42.  
  43. /**
  44. * Generate session key for the upload filename.
  45. */
  46. def Upload(fileId: String) = s"upload_${fileId}"
  47.  
  48. }
  49.  
  50. /**
  51. * Define request keys.
  52. */
  53. object Request {
  54.  
  55. /**
  56. * Request key for the Ajax request flag.
  57. */
  58. val Ajax = "AJAX"
  59.  
  60. /**
  61. * Request key for the username which is used during Git repository access.
  62. */
  63. val UserName = "USER_NAME"
  64.  
  65. /**
  66. * Generate request key for the request cache.
  67. */
  68. def Cache(key: String) = s"cache.${key}"
  69.  
  70. }
  71.  
  72. }