Class RequestScope


  • public class RequestScope
    extends java.lang.Object
    Provides something similar to a request scope in Spring or Guice. Objects are stored within Play's Http.Context which is created anew for each request. It's a very useful storage that lasts just for the current request. You can e.g. store a StudyRequest that you retrieved from the database and reuse it later on without having to retrieve it from the database again. This saves resources and brings performance.
    • Constructor Summary

      Constructors 
      Constructor Description
      RequestScope()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.Object get​(java.lang.String key)  
      static boolean has​(java.lang.String key)  
      static void put​(java.lang.String key, java.lang.Object value)
      Stores the given key-value pair in the request scope.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • RequestScope

        public RequestScope()
    • Method Detail

      • get

        public static java.lang.Object get​(java.lang.String key)
      • has

        public static boolean has​(java.lang.String key)
      • put

        public static void put​(java.lang.String key,
                               java.lang.Object value)
        Stores the given key-value pair in the request scope. If it's already stored it gets overwritten.