play famework 2.0 --該類別系列文章是對play2.0手冊中正對java開發者部分的簡略翻譯(錯誤是在所難免的)。
play 2.0是一個高生產力的Java和Scala Web應用框架,集成了你需要的現代web應用開發的組件和API。
Play基於一個輕量的、無國籍的、web友好的架構。基於複用(迭代)IO的反映模型,使他成爲一個功能
可預測並且消耗最小資源(CPU、內存、線程)的高可伸縮性的web應用框架。
Play的特性
強健快速
Play充分利用了Scala編譯器的能力檢測一切類型、避免運行時錯誤,擁有極高的性能表現。
反映模型
Play圍繞一個反映模型進行構建,該模型基於事件驅動和非阻塞IO。能夠實時響應。
可擴展
Play基於一個無狀態、web友好的框架,通過增加服務器就可以容易的進行擴展。
短週期
編輯你的文件然後保存,刷新你的瀏覽器就可以立即看到結果。不需要重新編譯、部署和重啓。
有趣&高效
減少你等待應用重啓花費的時間,提高生產力,讓你更快的完成項目。
真正的可擴展性
通過在多個Play服務器上運行你的程序輕易的進行擴展。
Java和Scala API
在同一個應用裏使用Java、Scala或者混合使用兩種語言,Play確保能夠容易的做大限度的使用Scala的特性,
同時保證與現有的Java代碼和庫能百分之百的兼容。
E:\play\apps>play new myApp
_ _
_ __ | | __ _ _ _| |
| '_ \| |/ _' | || |_|
| __/|_|\____|\__ (_)
|_| |__/
play! 2.0, http://www.playframework.org
The new application will be created in E:\play\apps\myApp
What is the application name?
> myApp
Which template do you want to use for this new application?
1 - Create a simple Scala application
2 - Create a simple Java application
3 - Create an empty project
> 2
OK, application myApp is created.
Have fun!
E:\play\apps>cd myApp
E:\play\apps\myApp>play
[info] Loading project definition from E:\play\apps\myApp\project
[info] Set current project to myApp (in build file:/E:/play/apps/myApp/)
_ _
_ __ | | __ _ _ _| |
| '_ \| |/ _' | || |_|
| __/|_|\____|\__ (_)
|_| |__/
play! 2.0, http://www.playframework.org
> Type "help play" or "license" for more information.
> Type "exit" or use Ctrl+D to leave this console.
[myApp] $ help play
Welcome to Play 2.0!
These commands are available:
-----------------------------
classpath Display the project classpath.
clean Clean all generated files.
compile Compile the current application.
console Launch the interactive Scala console (use :quit to exit).
dependencies Display the dependencies summary.
dist Construct standalone application package.
exit Exit the console.
h2-browser Launch the H2 Web browser.
license Display licensing informations.
package Package your application as a JAR.
play-version Display the Play version.
publish Publish your application in a remote repository.
publish-local Publish your application in the local repository.
reload Reload the current application build file.
run <port> Run the current application in DEV mode.
test Run Junit tests and/or Specs from the command line
eclipsify generate eclipse project file
idea generate Intellij IDEA project file
sh <command to run> execute a shell command
start <port> Start the current application in another JVM in PROD mode.
update Update application dependencies.
Type `help` to get the standard sbt help.
E:\play\apps\myApp>tree
文件夾 PATH 列表
卷序列號爲 0001-642E
E:.
├─app
│ ├─controllers
│ └─views
├─conf
├─project
│ ├─project
│ │ └─target
│ │ └─config-classes
│ └─target
│ ├─scala-2.9.1
│ │ └─sbt-0.11.2
│ │ ├─cache
│ │ │ ├─compile
│ │ │ └─update
│ │ └─classes
│ └─streams
│ ├─$global
│ │ ├─compilers
│ │ │ └─$global
│ │ ├─ivy-configuration
│ │ │ └─$global
│ │ ├─ivy-sbt
│ │ │ └─$global
│ │ ├─project-descriptors
│ │ │ └─$global
│ │ └─update
│ │ └─$global
│ └─compile
│ ├─$global
│ │ └─$global
│ ├─compile
│ │ └─$global
│ ├─compile-inputs
│ │ └─$global
│ ├─copy-resources
│ │ └─$global
│ └─defined-sbt-plugins
│ └─$global
├─public
│ ├─images
│ ├─javascripts
│ └─stylesheets
└─target