Reputation: 635
I am building my first controller with the Play Framework. I'm receiving the error:
Compilation error value getAll is not a member of controllers.api.protocol.Period
My routes.conf file looks like:
# Routes
# This file defines all application routes (Higher priority routes first)
# ~~~~
# Home page
GET / controllers.Application.index()
GET /api/protocol/period controllers.api.protocol.Period.getAll()
# Map static resources from the /public folder to the /assets URL path
GET /assets/*file controllers.Assets.versioned(path="/public", file: Asset)
and "controllers/api/protocol/Period.java" looks like:
package controllers.api.protocol;
import com.avaje.ebean.Model;
import play.mvc.Controller;
import java.util.List;
import play.mvc.*;
import static play.libs.Json.toJson;
public class Period extends Controller {
public static Result getAll() {
List<model.Protocol.Period> periods = new Model.Finder<Integer.class>(model.Protocol.Period.class).all();
return ok(toJson(periods));
}
}
I am lost.
Upvotes: 0
Views: 124
Reputation: 11508
That's great, and welcome. :)
Remove static
from public static Result getAll()
and you're sorted.
Upvotes: 1