【问题标题】:Play! framework routes. long data type玩!框架路线。长数据类型
【发布时间】:2012-08-03 06:12:36
【问题描述】:

似乎我在routes 中定义 Long 变量时遇到了问题。 这是 routes 文件中的一行:

GET   /topic/:id                    controllers.Topics.show(id: Long)

这是处理这条路线的方法:

public static Result show(long id) {
   // handle request here...
} 

我得到的是错误 324:

错误 324 (net::ERR_EMPTY_RESPONSE):服务器关闭了连接,没有发送任何数据。

我认为问题在于 Long 数据类型,因为使用 Int 它就像一个魅力。
使它起作用的调整是什么?

【问题讨论】:

    标签: java playframework playframework-2.0 web-development-server


    【解决方案1】:

    您必须在操作中使用Long 对象而不是long 主要类型:

    public static Result show(Long id) {
       // handle request here...
    } 
    

    【讨论】:

      猜你喜欢
      • 2011-10-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-09-21
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多