阅读更多

7顶
0踩

编程语言
play!为不喜欢传统JEE臃肿框架的程序员提供了一个敏捷的Web开发框架。
www.playframework.org


此次更新主要有:
1.自定义静态文件存放路径

So, to keep serving files from /public directory with the /public path, just add :

GET   /public                staticDir:public



2. 邮件系统支持
You can now define Mailer in your application. A mailer is subclass of play.mvc.Mailer, where each public static method send an email.

Example :
package notifiers;

import play.*;
import play.mvc.*;
import java.util.*;

public class Notifier extends Mailer {

   public static void welcome(User user) {
      setSubject("Welcome %s", user.name);
      addRecipient(user.email);
      addAttachment(Play.getFile("rules.pdf"));
      send(user);
   }

}


3. JPA重构

We have worked a lot on the JPA integration.

The JPA and JPAContext classes have been merged (JPAContext has been removed). Please replace the JPAContext.getEntityManager() call by JPA.getEntityManager().

A new find method is available in JPAModel :

Users.find().all(); // All results
Users.find().one(); // The first result or null
Users.find().page(1, 10); // First page with page size at 10


You can still set your own query. Either with a shortcut :
Users.find("email", email).one();
Users.find("email = ? and active = true", email).one();


Or by specifying a full JPQL query :

Users.find("from User u where u.email = ?", email).one();
Users.find("select u from User u where u.email = ?", email).one();


You can now count using a query :
Users.count(); // Count all user instances
Users.count("active", true); // Count all active users


Refresh and merge operation are directly available on JPAModel :
User user = User.findById(2L);
user.refresh();

User mergedUser = Cache.get("user", User.class).merge();


You can delete using a query :

Users.delete(); // delete all users
Users.delete("active", false); // delete all inactive users


You can still access the plain entityManager, with em() :
public void delete() {
    em().delete(this);
}



4.编译时间优化


The Java compilation process has been optimized and is now faster (especially for large projects).

Moreover, Play! now keep a Bytecode cache for all compiled resources (Java sources and templates). We keep an MD5 hash of the source code with each Bytecode and always compare it before to use a cached Bytecode.

This option is activated by default. You can disable it with :

play.bytecodeCache=false


in the application.conf file.


更多更新消息请看:


http://www.playframework.org/manual/contents/stable4


完整论坛程序下载:
http://www.playframework.org/download/samples/sample-forum.zip




  • 大小: 57.1 KB
7
0
评论 共 21 条 请登录后发表评论
21 楼 malligator 2009-07-17 00:48
谁说一下ibatis的SqlMapConfig.xml配置文件应该放哪里的?

我把它放在models里,一直报说找不到;
然后试一下把new File(.)的路径打出来,就是play!的安装目录,但我放在那里居然也不行
20 楼 laobu 2009-06-20 14:19
我也来试试先.
19 楼 fangzhouxing 2009-01-10 21:17
试过JBoss Seam->Spring 2.5->Grails, 最后还是看上Play!
18 楼 Arden 2008-12-30 20:19
用起来比Grails还要爽~
17 楼 Arden 2008-12-30 19:28
play! 框架的controller和model分包,及view下的html文件目录组织怎么搞?
16 楼 jejwe 2008-12-08 12:46
windows用cygwin可以正常使用
15 楼 ixu 2008-12-08 12:40
看起来很美,可惜windows下,但play命令行工具运行出错,不能使用,我用Msys模拟Unix环境,报路径错误。
14 楼 fight_bird 2008-12-07 11:51
这么多人看好,有用过的吗?说说。
13 楼 vonpower 2008-12-07 11:09
没有Windows版本的?
12 楼 glacier3 2008-12-06 21:06
个人爱好 
11 楼 neora 2008-12-06 19:57
可以肯定的说,play!这种模式将会是Java在Web开发最有吸引力的方向之一。类似的东西将如雨后春笋一样层出不穷。
10 楼 crackcell 2008-12-06 10:02
貌似不错的样子,赶紧试试。
9 楼 caiceclb 2008-12-06 09:36
数据库查询变得很容易,至少上面的例子是这样的
8 楼 ruderal 2008-12-05 18:50
好像用PHP一样用Java?!似乎很美丽的样子..老大们快评测下..
7 楼 avaj 2008-12-05 17:59
这个星球上最别致的一个java web开发框架。---呵呵,我来吹吹牛。

的确是一个非常不错的东西。试试你就知道咧。

6 楼 vdgame 2008-12-05 17:37
有用过的说说吗?
5 楼 fangzhouxing 2008-12-05 17:28
好像这正是我希望看到的RESTful java框架!
4 楼 peirenlei 2008-12-05 14:14
风格很象grails,但愿能发展壮大
3 楼 seasar 2008-12-05 12:20
清风徐徐吹来。。。。
2 楼 Arden 2008-12-05 12:13
这个框架看起来蛮不错的~

发表评论

您还没有登录,请您登录后再发表评论

相关推荐

Global site tag (gtag.js) - Google Analytics