Java play framework call an endpoint in routes from an inside project controller

Viewed 52

In my java play framework project (2.3 version) I need to call an exposed endpoint from outside also from inside my project. To be more specific, in another controller.

So in my routes I have this mapping:

POST     /evaluation/budgetamout                           @bank.controller.EvaluationController.evaluateBudgetAmount()

The controller EvaluationController contains a methods named as evaluateBudgetAmount:

public Result evaluateBudgetAmount() {
        ApiResponse response = new ApiResponse();
        JsonNode jsonNode = request().body().asJson();
        String result = // performe evaluations and save it into database passing jsonNode
        response.addData(result);
    return ok(response);

So in another controller with a specific method named as checkFinalResult I need to perform the call evaluateBudgetAmount giving a new input in the request(a new json in the post request), but I have no idea to figure out.

Surery I do not want to use the Promise to performed a new call inside my project that need to pass through from outside, to be clearer this approach is not admissible:

 F.Promise<WSResponse> rProm = WS.url(pathUrl).post(info);

There is another way?

0 Answers
Related