Ali
Ali

Reputation: 267077

Play Framework route not working though defined correctly

I have this simple route defined in Play's routes:

POST /test/post/$id<[0-9]+>  controllers.Test.post(id: Long)  

This is the code of Test.post method:

public static Result post(long id)
{
    return ok("working");
}

Another route in the same controller, POST /test controllers.Test.index() is working fine. However whenever I visit http://localhost:9000/test/post/3, I get a 'Connection reset' error in firefox immediately, and in google chrome I get a 'empty response' error. All other routes are working correctly.

What am I doing wrong?

Upvotes: 1

Views: 715

Answers (1)

ndeverge
ndeverge

Reputation: 21564

Use the Long object instead of the long native type in your Action :

public static Result post(Long id)
{
    return ok("working");
}

Upvotes: 1

Related Questions