1. XenForo 1.5.14 中文版——支持中文搜索!现已发布!查看详情
  2. Xenforo 爱好者讨论群:215909318 XenForo专区

新闻 ActFramework 1.7.0 - 1.8.1,高性能 Java Web 框架 下载

Discussion in '软件资讯' started by 漂亮的石头, 2018-03-12.

  1. 漂亮的石头

    漂亮的石头 版主 Staff Member

    Joined:
    2012-02-10
    Messages:
    488,399
    Likes Received:
    48
    没有及时发布新闻,真是不好意思。今天打个新闻批发,把 Act 1.7.0 到 1.8.1 中值得注意的更新给大家汇报一下。

    Act-1.8.1 - 2018-03-11


    • 支持 Request Forward

    @GetAction("shortcut/{shortUrl}")
    public void shortUrlHandler(String shortUrl, UrlMapper urlMapper) {
    String longUrl = urlMapper.get(shortUrl);
    Controller.Util.forward(longUrl);
    }

    forward 和 redirect 的区别:forward 不会发回 303 给浏览器,而是在应用内部直接分派到相关请求响应器。注意:forward 只支持 HTTP GET 请求

    更多 act-1.8.1 的内容

    Act-1.8.0 - 2018-03-04


    • 实现了新的响应输出模型,大大优化响应输出的内存,对大字节内容输出性能上有少量提升


    • 项目布局支持 gradle-groovy


    • CacheService 注入支持 @Named

    // Before
    private CacheService fooCache = Act.app().cache("foo");

    // After
    @Named("bar")
    @Inject
    private barCache;

    • timestamp auditing 支持在 base class 上定义的 timestamp 字段

    @MappedSuperClass
    public class BaseModel {

    @CreatedAt public Date created;
    @LastModifiedAt public Date lastModified;

    }

    • @Configuration 支持 static 字段

    @Configuration("foo.bar")
    public static String fooBar;

    更多 act-1.8.0 的内容

    Act-1.7.2 - 2018-02-25


    • 支持 Timestamp Audting

    public class User {
    public String username;
    ...
    @CreatedAt
    public Date created;
    @LastModified
    public Date lastModified;

    }

    更多 act-1.7.2 的内容

    Act-1.7.1 - 2018-02-21


    • 允许用户定义 action handler 支持 Partial Path

    @GetAction("/file/...")
    public File handleFileRequest(@PartialPath String filePath) {
    // filePath should be anything in the URL path that after `/file/`
    }

    更多 act-1.7.1 的内容

    Act-1.7.0 - 2018-02-19


    • 静态资源支持 DirectoryIndex - 自动查找目录下的 index.html 文件


    • API Doc TOC 以 HTTP Method 和 URL 组织


    • @Sensitive 数据字段支持

    // creditCardNo 字段内容会被框架加密处理后存入数据库
    // 从数据库取出数据时会自动解密
    public class User {
    public String firstName;
    public String lastName;
    public String email;
    public String mobile;
    @Sensitive
    public String creditCardNo;
    }

    • 简化密码字段处理

    // 老办法
    public class User {
    public String username;
    private String passhash;
    public void setPassword(String password) {
    passhash = Act.crypto().passwordHash(password);
    }
    }

    // 新办法
    public class User {
    public String username;
    @Password
    public String password;
    }

    • 简化方法执行的测量

    // 老方式
    public class Foo {
    private Metric metric = Act.metricPlugin().metric("app");
    // measure bar1 execution time
    public void bar1() {
    Timer timer = metric.startTimer("bar1");
    try {
    ...
    } finally {
    timer.stop();
    }
    }
    // measure bar2 execution count
    public void bar2() {
    metric.countOnce("bar2");
    ...
    }
    }

    // 新方式
    // define measure namespace.
    // `("foo")` is optional and can be inferred from class name
    @MetricLabel("foo")
    public class Foo {
    @MeasureTime("bar1") // ("bar1") is optional and can be inferred from method name
    public void bar1() {
    ...
    }
    @MeasureCount("bar2") // `("bar2")` is optional and can be inferred from method name
    public void bar2() {
    ...
    }
    }

    • AppEvent 重命名为 SysEvent, AppEventId 重命名为 SysEventId


    • 支持 JAX-RS 方式定义 Controller Action Handler

    public class TestController {

    // Act Style
    @GetAction("foo")
    public String foo() {return "foo";}

    // JAX-RS style
    @GET @PATH("bar")
    public String bar() {return "bar";}

    }

    public class Demo {
    @LoadResource("name.list")
    public List<String> nameList

    @LoadResource("name.list")
    public File nameListFile

    @LoadResource("name.list")
    public Set<String> uniqNameList;

    @LoadResource("pojo.json")
    public MyPojo myPojo;
    }

    更多 act-1.7.0 的内容
    ActFramework 1.7.0 - 1.8.1,高性能 Java Web 框架下载地址
     
Loading...