Package play

Class Play

java.lang.Object
play.Play

public class Play extends Object
Main framework class
  • Field Details

    • started

      public static boolean started
    • id

      public static String id
    • mode

      public static Play.Mode mode
    • appRoot

      public static File appRoot
    • tmpDir

      public static File tmpDir
    • classes

      public static final ApplicationClasses classes
    • templatesPath

      public static List<File> templatesPath
      All paths to search for templates files
    • routes

      public static ClasspathResource routes
      The routes file
    • configuration

      public static ConfProperties configuration
      The app configuration (already resolved from the framework id)
    • startedAt

      public static long startedAt
      The last time than the application has started
    • langs

      public static List<String> langs
      The list of supported locales
    • secretKey

      public static String secretKey
      The very secret key
    • pluginCollection

      public static PluginCollection pluginCollection
      pluginCollection that holds all loaded plugins and all enabled plugins
    • usePrecompiled

      public static boolean usePrecompiled
    • defaultWebEncoding

      public static final Charset defaultWebEncoding
      This is used as default encoding everywhere related to the web: request, response, WS
    • invoker

      public static Invoker invoker
    • beanSource

      public static BeanSource beanSource
      Not recommended to use directly. Instead, you should use @Inject annotation to inject your dependencies (either constructor or field injection).
  • Constructor Details

  • Method Details

    • init

      public void init(String id)
      Init the framework
      Parameters:
      id - The framework id to use
    • minimalInit

      public void minimalInit(String id)
      Minimalistic initialization of the framework; allowing DIY-initialization (no modules, no plugins from .plugins file, no routes from routes file, no config file)
      Parameters:
      id - The framework id to use
    • getActionInvoker

      public ActionInvoker getActionInvoker()
    • start

      public void start()
      Start the application
      Throws:
      IllegalArgumentException - if the application is already started
    • plugin

      public static <T extends PlayPlugin> T plugin(Class<T> clazz)
    • file

      public static @Nullable File file(String path)
      Search a File in the application
      Parameters:
      path - Relative path from the applications root
      Returns:
      The virtualFile or null
    • getFile

      public static File getFile(String path)
      Search a File in the current application
      Parameters:
      path - Relative path from the application root
      Returns:
      The file even if it doesn't exist
    • runningInTestMode

      public static boolean runningInTestMode()
      Returns true if application is running in test-mode. Test-mode is resolved from the framework id.

      Your app is running in test-mode if the framework id (Play.id) is 'test' or 'test-?.*'

      Returns:
      true if test mode
    • useDefaultMockMailSystem

      public static boolean useDefaultMockMailSystem()
    • relativePath

      public static String relativePath(File file)
      This logic was implemented in till v2.3.1 and got refactored to Play.relativePath in v2.4.0. In versions 2.4.0 - 2.6.3, it didn't work properly on Windows. :) Does not support special characters like spaces and backslashes in the path.
      Parameters:
      file - any local file in the application
      Returns:
      path to the file starting from application root (with slashes)