简体   繁体   English

玩! 框架路线。 长数据类型

[英]Play! framework routes. long data type

it seems that I have a problem with defining Long variables in routes . 似乎我在路由中定义Long变量时遇到问题。 this is the line in the routes file: 这是routes文件中的行:

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

and this is the method to handle this route: 这是处理此路线的方法:

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

what I get is error 324: 我得到的是错误324:

Error 324 (net::ERR_EMPTY_RESPONSE): The server closed the connection without sending any data. 错误324(net :: ERR_EMPTY_RESPONSE):服务器关闭连接而不发送任何数据。

I think the problem is with the Long data type because with Int it works like a charm. 我认为问题在于Long数据类型,因为使用Int它就像魅力一样。
what is the tweak to make it work? 什么是调整使其工作?

You have to use the Long object instead of the long primary type in your action: 您必须在操作中使用Long对象而不是long primary类型:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM